\hypertarget{group__lirc__client}{}\section{Client A\+P\+I}
\label{group__lirc__client}\index{Client A\+P\+I@{Client A\+P\+I}}


Basic interface to 3-\/rd party applications.  


\subsection*{Files}
\begin{DoxyCompactItemize}
\item 
file \hyperlink{lirc__client_8h}{lirc\+\_\+client.\+h}
\begin{DoxyCompactList}\small\item\em 3-\/rd party application interface. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx}
\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \hyperlink{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{lirc\+\_\+init} (const char $\ast$prog, int verbose)
\item 
int \hyperlink{group__lirc__client_ga50999022b09857ba43aa2f3f29c72b9e}{lirc\+\_\+deinit} (void)
\item 
int \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig} (const char $\ast$path, struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$$\ast$config, int(check)(char $\ast$s))
\item 
void \hyperlink{group__lirc__client_ga771f0592a8d378bc2ea314fdf4efa233}{lirc\+\_\+freeconfig} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config)
\item 
char $\ast$ \hyperlink{group__lirc__client_gafab5b5f56fb8bfb65b67d56d8426c2e1}{lirc\+\_\+nextir} (void)
\item 
char $\ast$ \hyperlink{group__lirc__client_gab9031bb1af5f068bacb1fe0d1fc6ca81}{lirc\+\_\+ir2char} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config, char $\ast$code)
\item 
int \hyperlink{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}{lirc\+\_\+nextcode} (char $\ast$$\ast$code)
\item 
int \hyperlink{group__lirc__client_ga8cb15780179dec56adc42559ee964a68}{lirc\+\_\+code2char} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config, char $\ast$code, char $\ast$$\ast$string)
\item 
int \hyperlink{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}{lirc\+\_\+readconfig\+\_\+only} (const char $\ast$file, struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$$\ast$config, int(check)(char $\ast$s))
\item 
\hypertarget{group__lirc__client_ga5d24b619ef689329ae2d085aa2bd412b}{}int {\bfseries lirc\+\_\+code2charprog} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config, char $\ast$code, char $\ast$$\ast$string, char $\ast$$\ast$prog)\label{group__lirc__client_ga5d24b619ef689329ae2d085aa2bd412b}

\item 
size\+\_\+t \hyperlink{group__lirc__client_gac572a64d1d7abbe776957c4fc7273bb7}{lirc\+\_\+getsocketname} (const char $\ast$id, char $\ast$buf, size\+\_\+t size)
\item 
const char $\ast$ \hyperlink{group__lirc__client_ga5161b44df0f73abbc48db605c98c9279}{lirc\+\_\+getmode} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config)
\item 
const char $\ast$ \hyperlink{group__lirc__client_ga28252340557d024ff5238c69f3875a38}{lirc\+\_\+setmode} (struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$config, const char $\ast$mode)
\item 
int \hyperlink{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc}{lirc\+\_\+command\+\_\+init} (\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$ctx, const char $\ast$fmt,...)
\item 
int \hyperlink{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99}{lirc\+\_\+command\+\_\+run} (\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$ctx, int fd)
\item 
void \hyperlink{group__lirc__client_gace4d40f00918d8bdf9a4f6df0fb0155d}{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout} (\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$ctx)
\item 
int \hyperlink{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31}{lirc\+\_\+send\+\_\+one} (int fd, const char $\ast$remote, const char $\ast$keysym)
\item 
int \hyperlink{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5}{lirc\+\_\+simulate} (int fd, const char $\ast$remote, const char $\ast$keysym, int scancode, int repeat)
\item 
int \hyperlink{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}{lirc\+\_\+get\+\_\+remote\+\_\+socket} (const char $\ast$address, int port, int quiet)
\item 
int \hyperlink{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{lirc\+\_\+get\+\_\+local\+\_\+socket} (const char $\ast$path, int quiet)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
Basic interface to 3-\/rd party applications. 

The lirc\+\_\+client interface is the basic interface for 3-\/rd party applications using lirc. It provides functions to retrieve , send and control button events to/from remotes.

Receiving events from remotes could be done according to the following example, a stripped down version of the irexec(1) tool. \begin{DoxyVerb}   #include "lirc_client.h"

   int main(int argc, char* argv[])
   {
       const char* lircrc_path;
       struct lirc_config* config;
       char* code;
       char* s;

       // Check arguments... use argv[1] as lircrc config file path.
       lircrc_path = argc == 2 ? argv[1] : NULL;

       if (lirc_init("mythtv", 1) == -1) {
           // Process error and exit
       }
       if (lirc_readconfig(lircrc_path, &config, NULL) != 0) {
           // Process error and exit.
       }
       while (lirc_nextcode(&code) == 0) {
           if (code == NULL) continue;
           while (lirc_code2char(config, code, &s) == 0 && s != NULL) {
               // Do something with string s.
           }
           free(code);
       }
       lirc_freeconfig(config);
       lirc_deinit();
       exit(0);
   }
\end{DoxyVerb}


Some notes\+:
\begin{DoxyItemize}
\item \hyperlink{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{lirc\+\_\+init()} connects to the lircd daemon socket. The program given as argument is used when we later call \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()} to determine what translation(s) to use. Thus it should match the {\ttfamily program = ...} items in the lircrc config file.
\item \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()} parses the lircrc config file into \&config. Using N\+U\+L\+L as path means that the default lircrc file is used.
\item \hyperlink{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}{lirc\+\_\+nextcode()} reads the next button event from lircd. For the purposes here the returned code is just an opaque handle. It will sometimes return on a timeout without any data available, thus the {\ttfamily if (code == N\+U\+L\+L) continue} statement.
\item \hyperlink{group__lirc__client_ga8cb15780179dec56adc42559ee964a68}{lirc\+\_\+code2char()} translates the code handle to one ore more application specific string as defined in the licrrc file. Since more than one string can be returned \hyperlink{group__lirc__client_ga8cb15780179dec56adc42559ee964a68}{lirc\+\_\+code2char()} should be called until it returns a N\+U\+L\+L string.
\item The complete source for this example is in \hyperlink{irexec_8cpp-example}{irexec.\+cpp}
\end{DoxyItemize}

Sending (blasting) is done according to following\+: \begin{DoxyVerb}#include "lirc_client.h"

int main(int argc, char** argv)
{
    int fd;

    fd = lirc_get_local_socket(NULL, 0);
    if (fd < 0) {
        // Process error
    }
    if (lirc_send_one(fd, "name of remote", "Key symbol") == -1) {
        // Process errors
    };
}
\end{DoxyVerb}


Notes\+:
\begin{DoxyItemize}
\item Feeding N\+U\+L\+L to \hyperlink{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{lirc\+\_\+get\+\_\+local\+\_\+socket()} will make it use the default lircd socket. Doing so, it respects the L\+I\+R\+C\+\_\+\+S\+O\+C\+K\+E\+T\+\_\+\+P\+A\+T\+H environment variable.
\item \char`\"{}\+Name of remote\char`\"{} is the mandatory name attribute in the lircd.\+conf config file.
\item \char`\"{}\+Key symbol\char`\"{} is the name of a key definition in the lircd.\+conf file.
\item \hyperlink{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31}{lirc\+\_\+send\+\_\+one()} and \hyperlink{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5}{lirc\+\_\+simulate()} are blocking. If you need to do non-\/blocking I\+O and/or access other functionality available you need to use \hyperlink{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc}{lirc\+\_\+command\+\_\+init()} and \hyperlink{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99}{lirc\+\_\+command\+\_\+run()}. Example code is in \hyperlink{irsend_8cpp-example}{irsend.\+cpp}. 
\end{DoxyItemize}

\subsection{Function Documentation}
\hypertarget{group__lirc__client_ga8cb15780179dec56adc42559ee964a68}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+code2char@{lirc\+\_\+code2char}}
\index{lirc\+\_\+code2char@{lirc\+\_\+code2char}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+code2char}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+code2char (
\begin{DoxyParamCaption}
\item[{struct {\bf lirc\+\_\+config} $\ast$}]{config, }
\item[{char $\ast$}]{code, }
\item[{char $\ast$$\ast$}]{string}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga8cb15780179dec56adc42559ee964a68}
Translate a code string to an application string using .lircrc. An translation might return more than one string so this function should be called several times until $\ast$string == N\+U\+L\+L.


\begin{DoxyParams}{Parameters}
{\em config} & Parsed lircrc data from e. g. \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()}. \\
\hline
{\em code} & Code string e. g., as from \hyperlink{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}{lirc\+\_\+nextcode()}. \\
\hline
{\em string} & On successfull exit points to a static application string, N\+U\+L\+L if no more translations are available. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


Definition at line 1792 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+command\+\_\+init@{lirc\+\_\+command\+\_\+init}}
\index{lirc\+\_\+command\+\_\+init@{lirc\+\_\+command\+\_\+init}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+command\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+command\+\_\+init (
\begin{DoxyParamCaption}
\item[{{\bf lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx, }
\item[{const char $\ast$}]{fmt, }
\item[{}]{...}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc}
Initiate a \hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} to run a command.


\begin{DoxyParams}{Parameters}
{\em ctx} & Undefined om input, ready to execute on exit. \\
\hline
{\em fmt,...} & printf-\/style formatting for command. Don\textquotesingle{}t forget trailing \char`\"{}\textbackslash{}n\char`\"{}! \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on O\+K, else a kernel error code. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
Simple example\+: {\ttfamily lirc\+\_\+command\+\_\+init(\&ctx, \char`\"{}\+C\+O\+D\+E \%s\textbackslash{}\textbackslash{}n\char`\"{}, code)}; 
\end{DoxyNote}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 104 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gace4d40f00918d8bdf9a4f6df0fb0155d}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout@{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout}}
\index{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout@{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout}]{\setlength{\rightskip}{0pt plus 5cm}void lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout (
\begin{DoxyParamCaption}
\item[{{\bf lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gace4d40f00918d8bdf9a4f6df0fb0155d}
Set command\+\_\+ctx write\+\_\+to\+\_\+stdout flag. When set, the reply payload is written to stdout instead of the default behavior to store it in ctx-\/$>$reply. \begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 121 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+command\+\_\+run@{lirc\+\_\+command\+\_\+run}}
\index{lirc\+\_\+command\+\_\+run@{lirc\+\_\+command\+\_\+run}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+command\+\_\+run}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+command\+\_\+run (
\begin{DoxyParamCaption}
\item[{{\bf lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx, }
\item[{int}]{fd}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99}
Run a command in non-\/blocking mode.


\begin{DoxyParams}{Parameters}
{\em ctx} & Initiated data on enter, possibly reply payload in ctx-\/$>$reply on exit. \\
\hline
{\em fd} & Open file connected to a lircd output socket. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on O\+K, else a kernel error code (possibly E\+A\+G\+A\+I\+N). 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 179 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga50999022b09857ba43aa2f3f29c72b9e}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+deinit@{lirc\+\_\+deinit}}
\index{lirc\+\_\+deinit@{lirc\+\_\+deinit}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+deinit}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+deinit (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga50999022b09857ba43aa2f3f29c72b9e}
Release resources allocated by \hyperlink{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{lirc\+\_\+init()}, basically disconnect from socket. 

Definition at line 353 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga771f0592a8d378bc2ea314fdf4efa233}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+freeconfig@{lirc\+\_\+freeconfig}}
\index{lirc\+\_\+freeconfig@{lirc\+\_\+freeconfig}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+freeconfig}]{\setlength{\rightskip}{0pt plus 5cm}void lirc\+\_\+freeconfig (
\begin{DoxyParamCaption}
\item[{struct {\bf lirc\+\_\+config} $\ast$}]{config}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga771f0592a8d378bc2ea314fdf4efa233}
Deallocate an object retrieved using \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()}. 

Definition at line 1513 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+get\+\_\+local\+\_\+socket@{lirc\+\_\+get\+\_\+local\+\_\+socket}}
\index{lirc\+\_\+get\+\_\+local\+\_\+socket@{lirc\+\_\+get\+\_\+local\+\_\+socket}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+get\+\_\+local\+\_\+socket}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+get\+\_\+local\+\_\+socket (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{int}]{quiet}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}
Return an opened and connected file descriptor to local lirc socket.


\begin{DoxyParams}{Parameters}
{\em path} & Path to socket. If N\+U\+L\+L use L\+I\+R\+C\+\_\+\+S\+O\+C\+K\+E\+T\+\_\+\+P\+A\+T\+H in environment, falling back to a hardcoded lircd default. \\
\hline
{\em quiet} & If true, don\textquotesingle{}t write error messages on stderr. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
positive file descriptor on success, else a negated kernel error code. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 2028 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+get\+\_\+remote\+\_\+socket@{lirc\+\_\+get\+\_\+remote\+\_\+socket}}
\index{lirc\+\_\+get\+\_\+remote\+\_\+socket@{lirc\+\_\+get\+\_\+remote\+\_\+socket}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+get\+\_\+remote\+\_\+socket}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+get\+\_\+remote\+\_\+socket (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{address, }
\item[{int}]{port, }
\item[{int}]{quiet}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}
Return an opened and connected file descriptor to remote lirc socket.


\begin{DoxyParams}{Parameters}
{\em address} & Remote host to connect to. \\
\hline
{\em port} & T\+C\+P port. If $<$= 0 uses hardcoded default L\+I\+R\+C\+\_\+\+I\+N\+E\+T\+\_\+\+P\+O\+R\+T. \\
\hline
{\em quiet} & If true, don\textquotesingle{}t write error messages on stderr. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
positive file descriptor on success, else a negated kernel error code. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 2050 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga5161b44df0f73abbc48db605c98c9279}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+getmode@{lirc\+\_\+getmode}}
\index{lirc\+\_\+getmode@{lirc\+\_\+getmode}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+getmode}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ lirc\+\_\+getmode (
\begin{DoxyParamCaption}
\item[{struct {\bf lirc\+\_\+config} $\ast$}]{config}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga5161b44df0f73abbc48db605c98c9279}
Get mode defined in lircrc. Will use lircrcd if available, else local data.


\begin{DoxyParams}{Parameters}
{\em config} & Parsed lircrc file as obtained from \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()} or \hyperlink{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}{lirc\+\_\+readconfig\+\_\+only()}. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Current mode or N\+U\+L\+L on errors. 
\end{DoxyReturn}


Definition at line 1918 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gac572a64d1d7abbe776957c4fc7273bb7}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+getsocketname@{lirc\+\_\+getsocketname}}
\index{lirc\+\_\+getsocketname@{lirc\+\_\+getsocketname}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+getsocketname}]{\setlength{\rightskip}{0pt plus 5cm}size\+\_\+t lirc\+\_\+getsocketname (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{id, }
\item[{char $\ast$}]{buf, }
\item[{size\+\_\+t}]{size}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gac572a64d1d7abbe776957c4fc7273bb7}
Retrieve default lircrcd socket path.


\begin{DoxyParams}{Parameters}
{\em id} & Optional socket id, defaults (id == N\+U\+L\+L) to \char`\"{}default\char`\"{}. \\
\hline
{\em buf} & Return buffer. \\
\hline
{\em size} & Size of return buffer. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


Definition at line 1909 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+init@{lirc\+\_\+init}}
\index{lirc\+\_\+init@{lirc\+\_\+init}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+init}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+init (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{prog, }
\item[{int}]{verbose}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}
Initial setup\+: connect to lircd socket.


\begin{DoxyParams}{Parameters}
{\em prog} & Name of client in logging contexts. \\
\hline
{\em verbose} & Amount of debug info on stdout. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
positive file descriptor or -\/1 + error in global errno. 
\end{DoxyReturn}


Definition at line 332 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gab9031bb1af5f068bacb1fe0d1fc6ca81}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+ir2char@{lirc\+\_\+ir2char}}
\index{lirc\+\_\+ir2char@{lirc\+\_\+ir2char}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+ir2char}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ lirc\+\_\+ir2char (
\begin{DoxyParamCaption}
\item[{struct {\bf lirc\+\_\+config} $\ast$}]{config, }
\item[{char $\ast$}]{code}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gab9031bb1af5f068bacb1fe0d1fc6ca81}
\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000002}{Deprecated}]obsolete \end{DoxyRefDesc}


Definition at line 1705 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+nextcode@{lirc\+\_\+nextcode}}
\index{lirc\+\_\+nextcode@{lirc\+\_\+nextcode}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+nextcode}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+nextcode (
\begin{DoxyParamCaption}
\item[{char $\ast$$\ast$}]{code}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}
Get next available code from the lircd daemon.


\begin{DoxyParams}{Parameters}
{\em code} & Undefined on enter. On exit either N\+U\+L\+L if no complete code was available, else a pointer to a malloc()\textquotesingle{}d code string. Caller should eventually free() this. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0 indicating either a complete code in $\ast$code or that nothing was available. 
\end{DoxyReturn}


Definition at line 1851 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gafab5b5f56fb8bfb65b67d56d8426c2e1}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+nextir@{lirc\+\_\+nextir}}
\index{lirc\+\_\+nextir@{lirc\+\_\+nextir}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+nextir}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ lirc\+\_\+nextir (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gafab5b5f56fb8bfb65b67d56d8426c2e1}
\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000001}{Deprecated}]obsolete \end{DoxyRefDesc}


Definition at line 1833 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+readconfig@{lirc\+\_\+readconfig}}
\index{lirc\+\_\+readconfig@{lirc\+\_\+readconfig}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+readconfig}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+readconfig (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{path, }
\item[{struct {\bf lirc\+\_\+config} $\ast$$\ast$}]{config, }
\item[{int(check)(char $\ast$s)}]{}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}
Parse a lircrc configuration file. This function will also try to connect to a lircrcd instance on the default socket which is derived from path.


\begin{DoxyParams}{Parameters}
{\em path} & Path to lircrc config file. If N\+U\+L\+L the default file is used. \\
\hline
{\em config} & Undefined omn enter, on successfull exit a pointer to an allocated \hyperlink{structlirc__config}{lirc\+\_\+config} instance. \\
\hline
{\em check} & Callback function called with each configured application string as argument. Returns 0 if string is O\+K, else -\/1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


Definition at line 1426 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+readconfig\+\_\+only@{lirc\+\_\+readconfig\+\_\+only}}
\index{lirc\+\_\+readconfig\+\_\+only@{lirc\+\_\+readconfig\+\_\+only}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+readconfig\+\_\+only}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+readconfig\+\_\+only (
\begin{DoxyParamCaption}
\item[{const char $\ast$}]{file, }
\item[{struct {\bf lirc\+\_\+config} $\ast$$\ast$}]{config, }
\item[{int(check)(char $\ast$s)}]{}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}
Parse a lircrc configuration file without connecting to lircrcd.


\begin{DoxyParams}{Parameters}
{\em path} & Path to lircrc config file. If N\+U\+L\+L the default file is used. \\
\hline
{\em config} & Undefined omn enter, on successfull exit a pointer to an allocated \hyperlink{structlirc__config}{lirc\+\_\+config} instance. \\
\hline
{\em check} & Callback function called with each configured application string as argument. Returns o if string is O\+K, else -\/1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


Definition at line 1505 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+send\+\_\+one@{lirc\+\_\+send\+\_\+one}}
\index{lirc\+\_\+send\+\_\+one@{lirc\+\_\+send\+\_\+one}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+send\+\_\+one}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+send\+\_\+one (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{const char $\ast$}]{remote, }
\item[{const char $\ast$}]{keysym}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31}
Send keysym using given remote. This call might block for some time since it involves communication with lircd.


\begin{DoxyParams}{Parameters}
{\em fd} & File descriptor for lircd socket. This must not be the descriptor returned by \hyperlink{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{lirc\+\_\+init()}; open the socket using \hyperlink{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{lirc\+\_\+get\+\_\+local\+\_\+socket()} or \hyperlink{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}{lirc\+\_\+get\+\_\+remote\+\_\+socket()}k instead. \\
\hline
{\em remote} & Name of remote, the \textquotesingle{}name\textquotesingle{} attribute in the config file. \\
\hline
{\em keysym} & The code to send, as defined in the config file. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 1967 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga28252340557d024ff5238c69f3875a38}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+setmode@{lirc\+\_\+setmode}}
\index{lirc\+\_\+setmode@{lirc\+\_\+setmode}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+setmode}]{\setlength{\rightskip}{0pt plus 5cm}const char$\ast$ lirc\+\_\+setmode (
\begin{DoxyParamCaption}
\item[{struct {\bf lirc\+\_\+config} $\ast$}]{config, }
\item[{const char $\ast$}]{mode}
\end{DoxyParamCaption}
)}\label{group__lirc__client_ga28252340557d024ff5238c69f3875a38}
Set mode defined in lircrc. Will use lircrcd if available, else use local data.


\begin{DoxyParams}{Parameters}
{\em config} & Parsed lircrc file as obtained from \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()} or \hyperlink{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}{lirc\+\_\+readconfig\+\_\+only()}. \\
\hline
{\em mode} & A new mode defined in lircrc. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
New mode, should match mode unless there is errors. 
\end{DoxyReturn}


Definition at line 1939 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5}{}\index{Client A\+P\+I@{Client A\+P\+I}!lirc\+\_\+simulate@{lirc\+\_\+simulate}}
\index{lirc\+\_\+simulate@{lirc\+\_\+simulate}!Client A\+P\+I@{Client A\+P\+I}}
\subsubsection[{lirc\+\_\+simulate}]{\setlength{\rightskip}{0pt plus 5cm}int lirc\+\_\+simulate (
\begin{DoxyParamCaption}
\item[{int}]{fd, }
\item[{const char $\ast$}]{remote, }
\item[{const char $\ast$}]{keysym, }
\item[{int}]{scancode, }
\item[{int}]{repeat}
\end{DoxyParamCaption}
)}\label{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5}
Send a simulated lirc event.\+This call might block for some time since it involves communication with lircd.


\begin{DoxyParams}{Parameters}
{\em fd} & File descriptor for lircd socket. This must not be the descriptor returned by lirc\+\_\+init; open the socket using \hyperlink{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{lirc\+\_\+get\+\_\+local\+\_\+socket()} or \hyperlink{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}{lirc\+\_\+get\+\_\+remote\+\_\+socket()} instead. \\
\hline
{\em remote} & Name of remote, the \textquotesingle{}name\textquotesingle{} attribute in the config file. \\
\hline
{\em keysym} & The code to send, as defined in the config file. \\
\hline
{\em scancode} & The code bound the keysym in teh config file. \\
\hline
{\em repeat} & Number indicating how many times this code has been repeated, starts at 0, increased for each repetition. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


Definition at line 1982 of file lirc\+\_\+client.\+c.

