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


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}{}\label{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)
\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\+LL 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\+LL) 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\+LL 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\+LL 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\+TH 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 IO 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}{}\label{group__lirc__client_ga8cb15780179dec56adc42559ee964a68} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+code2char@{lirc\+\_\+code2char}}
\index{lirc\+\_\+code2char@{lirc\+\_\+code2char}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+code2char()}{lirc\_code2char()}}
{\footnotesize\ttfamily int lirc\+\_\+code2char (\begin{DoxyParamCaption}\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$}]{config,  }\item[{char $\ast$}]{code,  }\item[{char $\ast$$\ast$}]{string }\end{DoxyParamCaption})}

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\+LL.


\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\+LL if no more translations are available. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


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

\hypertarget{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc}{}\label{group__lirc__client_ga3787c58d32391a5b7c40337fdbee95fc} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+command\+\_\+init@{lirc\+\_\+command\+\_\+init}}
\index{lirc\+\_\+command\+\_\+init@{lirc\+\_\+command\+\_\+init}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+command\+\_\+init()}{lirc\_command\_init()}}
{\footnotesize\ttfamily int lirc\+\_\+command\+\_\+init (\begin{DoxyParamCaption}\item[{\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx,  }\item[{const char $\ast$}]{fmt,  }\item[{}]{... }\end{DoxyParamCaption})}

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 OK, else a kernel error code. 
\end{DoxyReturn}
\begin{DoxyNote}{Note}
Simple example\+: {\ttfamily lirc\+\_\+command\+\_\+init(\&ctx, \char`\"{}\+C\+O\+D\+E \%s\textbackslash{}n\char`\"{}, code)}; 
\end{DoxyNote}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


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

\hypertarget{group__lirc__client_gace4d40f00918d8bdf9a4f6df0fb0155d}{}\label{group__lirc__client_gace4d40f00918d8bdf9a4f6df0fb0155d} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout@{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout}}
\index{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout@{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout()}{lirc\_command\_reply\_to\_stdout()}}
{\footnotesize\ttfamily void lirc\+\_\+command\+\_\+reply\+\_\+to\+\_\+stdout (\begin{DoxyParamCaption}\item[{\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx }\end{DoxyParamCaption})}

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 122 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99}{}\label{group__lirc__client_ga888d275e1b0cf4988e44fb15f24d2a99} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+command\+\_\+run@{lirc\+\_\+command\+\_\+run}}
\index{lirc\+\_\+command\+\_\+run@{lirc\+\_\+command\+\_\+run}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+command\+\_\+run()}{lirc\_command\_run()}}
{\footnotesize\ttfamily int lirc\+\_\+command\+\_\+run (\begin{DoxyParamCaption}\item[{\hyperlink{structlirc__cmd__ctx}{lirc\+\_\+cmd\+\_\+ctx} $\ast$}]{ctx,  }\item[{int}]{fd }\end{DoxyParamCaption})}

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 OK, else a kernel error code (possibly E\+A\+G\+A\+IN). 
\end{DoxyReturn}
\begin{DoxySince}{Since}
0.\+9.\+2 
\end{DoxySince}


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

\hypertarget{group__lirc__client_ga50999022b09857ba43aa2f3f29c72b9e}{}\label{group__lirc__client_ga50999022b09857ba43aa2f3f29c72b9e} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+deinit@{lirc\+\_\+deinit}}
\index{lirc\+\_\+deinit@{lirc\+\_\+deinit}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+deinit()}{lirc\_deinit()}}
{\footnotesize\ttfamily int lirc\+\_\+deinit (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}

Release resources allocated by \hyperlink{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{lirc\+\_\+init()}, basically disconnect from socket. 

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

\hypertarget{group__lirc__client_ga771f0592a8d378bc2ea314fdf4efa233}{}\label{group__lirc__client_ga771f0592a8d378bc2ea314fdf4efa233} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+freeconfig@{lirc\+\_\+freeconfig}}
\index{lirc\+\_\+freeconfig@{lirc\+\_\+freeconfig}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+freeconfig()}{lirc\_freeconfig()}}
{\footnotesize\ttfamily void lirc\+\_\+freeconfig (\begin{DoxyParamCaption}\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$}]{config }\end{DoxyParamCaption})}

Deallocate an object retrieved using \hyperlink{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{lirc\+\_\+readconfig()}. 

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

\hypertarget{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1}{}\label{group__lirc__client_ga13cf4c784df60143d2b171645f4e84c1} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+get\+\_\+local\+\_\+socket@{lirc\+\_\+get\+\_\+local\+\_\+socket}}
\index{lirc\+\_\+get\+\_\+local\+\_\+socket@{lirc\+\_\+get\+\_\+local\+\_\+socket}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+get\+\_\+local\+\_\+socket()}{lirc\_get\_local\_socket()}}
{\footnotesize\ttfamily int lirc\+\_\+get\+\_\+local\+\_\+socket (\begin{DoxyParamCaption}\item[{const char $\ast$}]{path,  }\item[{int}]{quiet }\end{DoxyParamCaption})}

Return an opened and connected file descriptor to local lirc socket.


\begin{DoxyParams}{Parameters}
{\em path} & Path to socket. If N\+U\+LL use L\+I\+R\+C\+\_\+\+S\+O\+C\+K\+E\+T\+\_\+\+P\+A\+TH 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 2042 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30}{}\label{group__lirc__client_ga81b8a02fdab2ef6d21930bbefabedf30} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+get\+\_\+remote\+\_\+socket@{lirc\+\_\+get\+\_\+remote\+\_\+socket}}
\index{lirc\+\_\+get\+\_\+remote\+\_\+socket@{lirc\+\_\+get\+\_\+remote\+\_\+socket}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+get\+\_\+remote\+\_\+socket()}{lirc\_get\_remote\_socket()}}
{\footnotesize\ttfamily int lirc\+\_\+get\+\_\+remote\+\_\+socket (\begin{DoxyParamCaption}\item[{const char $\ast$}]{address,  }\item[{int}]{port,  }\item[{int}]{quiet }\end{DoxyParamCaption})}

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\+CP port. If $<$= 0 uses hardcoded default L\+I\+R\+C\+\_\+\+I\+N\+E\+T\+\_\+\+P\+O\+RT. \\
\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 2064 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga5161b44df0f73abbc48db605c98c9279}{}\label{group__lirc__client_ga5161b44df0f73abbc48db605c98c9279} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+getmode@{lirc\+\_\+getmode}}
\index{lirc\+\_\+getmode@{lirc\+\_\+getmode}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+getmode()}{lirc\_getmode()}}
{\footnotesize\ttfamily const char$\ast$ lirc\+\_\+getmode (\begin{DoxyParamCaption}\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$}]{config }\end{DoxyParamCaption})}

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\+LL on errors. 
\end{DoxyReturn}


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

\hypertarget{group__lirc__client_gac572a64d1d7abbe776957c4fc7273bb7}{}\label{group__lirc__client_gac572a64d1d7abbe776957c4fc7273bb7} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+getsocketname@{lirc\+\_\+getsocketname}}
\index{lirc\+\_\+getsocketname@{lirc\+\_\+getsocketname}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+getsocketname()}{lirc\_getsocketname()}}
{\footnotesize\ttfamily size\+\_\+t lirc\+\_\+getsocketname (\begin{DoxyParamCaption}\item[{const char $\ast$}]{id,  }\item[{char $\ast$}]{buf,  }\item[{size\+\_\+t}]{size }\end{DoxyParamCaption})}

Retrieve default lircrcd socket path.


\begin{DoxyParams}{Parameters}
{\em id} & Optional socket id, defaults (id == N\+U\+LL) 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 1923 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001}{}\label{group__lirc__client_gaf92c865f0895259aa40e2aed51c71001} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+init@{lirc\+\_\+init}}
\index{lirc\+\_\+init@{lirc\+\_\+init}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+init()}{lirc\_init()}}
{\footnotesize\ttfamily int lirc\+\_\+init (\begin{DoxyParamCaption}\item[{const char $\ast$}]{prog,  }\item[{int}]{verbose }\end{DoxyParamCaption})}

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 339 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gab9031bb1af5f068bacb1fe0d1fc6ca81}{}\label{group__lirc__client_gab9031bb1af5f068bacb1fe0d1fc6ca81} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+ir2char@{lirc\+\_\+ir2char}}
\index{lirc\+\_\+ir2char@{lirc\+\_\+ir2char}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+ir2char()}{lirc\_ir2char()}}
{\footnotesize\ttfamily char$\ast$ lirc\+\_\+ir2char (\begin{DoxyParamCaption}\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$}]{config,  }\item[{char $\ast$}]{code }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000002}{Deprecated}]obsolete \end{DoxyRefDesc}


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

\hypertarget{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3}{}\label{group__lirc__client_gaf352dc9bb17d32c0f867ce5ca8a2f2d3} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+nextcode@{lirc\+\_\+nextcode}}
\index{lirc\+\_\+nextcode@{lirc\+\_\+nextcode}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+nextcode()}{lirc\_nextcode()}}
{\footnotesize\ttfamily int lirc\+\_\+nextcode (\begin{DoxyParamCaption}\item[{char $\ast$$\ast$}]{code }\end{DoxyParamCaption})}

Get next available code from the lircd daemon.


\begin{DoxyParams}{Parameters}
{\em code} & Undefined on enter. On exit either N\+U\+LL 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 1865 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gafab5b5f56fb8bfb65b67d56d8426c2e1}{}\label{group__lirc__client_gafab5b5f56fb8bfb65b67d56d8426c2e1} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+nextir@{lirc\+\_\+nextir}}
\index{lirc\+\_\+nextir@{lirc\+\_\+nextir}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+nextir()}{lirc\_nextir()}}
{\footnotesize\ttfamily char$\ast$ lirc\+\_\+nextir (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}

\begin{DoxyRefDesc}{Deprecated}
\item[\hyperlink{deprecated__deprecated000001}{Deprecated}]obsolete \end{DoxyRefDesc}


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

\hypertarget{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972}{}\label{group__lirc__client_ga62e50c43a39bd8858d42bc11adf40972} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+readconfig@{lirc\+\_\+readconfig}}
\index{lirc\+\_\+readconfig@{lirc\+\_\+readconfig}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+readconfig()}{lirc\_readconfig()}}
{\footnotesize\ttfamily int lirc\+\_\+readconfig (\begin{DoxyParamCaption}\item[{const char $\ast$}]{path,  }\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$$\ast$}]{config,  }\item[{int(check)(char $\ast$s)}]{ }\end{DoxyParamCaption})}

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\+LL 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 OK, else -\/1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


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

\hypertarget{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90}{}\label{group__lirc__client_ga94642edfbd32527a6a9b9c761be9ad90} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+readconfig\+\_\+only@{lirc\+\_\+readconfig\+\_\+only}}
\index{lirc\+\_\+readconfig\+\_\+only@{lirc\+\_\+readconfig\+\_\+only}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+readconfig\+\_\+only()}{lirc\_readconfig\_only()}}
{\footnotesize\ttfamily int lirc\+\_\+readconfig\+\_\+only (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$$\ast$}]{config,  }\item[{int(check)(char $\ast$s)}]{ }\end{DoxyParamCaption})}

Parse a lircrc configuration file without connecting to lircrcd.


\begin{DoxyParams}{Parameters}
{\em path} & Path to lircrc config file. If N\+U\+LL 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 OK, else -\/1. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on errors, else 0. 
\end{DoxyReturn}


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

\hypertarget{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31}{}\label{group__lirc__client_ga0e86e3a29c14dc8047651e0bb9c49b31} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+send\+\_\+one@{lirc\+\_\+send\+\_\+one}}
\index{lirc\+\_\+send\+\_\+one@{lirc\+\_\+send\+\_\+one}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+send\+\_\+one()}{lirc\_send\_one()}}
{\footnotesize\ttfamily int lirc\+\_\+send\+\_\+one (\begin{DoxyParamCaption}\item[{int}]{fd,  }\item[{const char $\ast$}]{remote,  }\item[{const char $\ast$}]{keysym }\end{DoxyParamCaption})}

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 1981 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_ga28252340557d024ff5238c69f3875a38}{}\label{group__lirc__client_ga28252340557d024ff5238c69f3875a38} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+setmode@{lirc\+\_\+setmode}}
\index{lirc\+\_\+setmode@{lirc\+\_\+setmode}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+setmode()}{lirc\_setmode()}}
{\footnotesize\ttfamily const char$\ast$ lirc\+\_\+setmode (\begin{DoxyParamCaption}\item[{struct \hyperlink{structlirc__config}{lirc\+\_\+config} $\ast$}]{config,  }\item[{const char $\ast$}]{mode }\end{DoxyParamCaption})}

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 1953 of file lirc\+\_\+client.\+c.

\hypertarget{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5}{}\label{group__lirc__client_gad5d41d33e0c1fc3002cdf8c0d9aa43d5} 
\index{Client A\+PI@{Client A\+PI}!lirc\+\_\+simulate@{lirc\+\_\+simulate}}
\index{lirc\+\_\+simulate@{lirc\+\_\+simulate}!Client A\+PI@{Client A\+PI}}
\subsubsection{\texorpdfstring{lirc\+\_\+simulate()}{lirc\_simulate()}}
{\footnotesize\ttfamily 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})}

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 the 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 1996 of file lirc\+\_\+client.\+c.

