1 |
#include "EXTERN.h" |
2 |
#include "perl.h" |
3 |
#include "XSUB.h" |
4 |
|
5 |
#include <lirc/lirc_client.h> |
6 |
|
7 |
struct lirc_config *config; |
8 |
|
9 |
MODULE = RCU::Lirc PACKAGE = RCU::Lirc |
10 |
|
11 |
PROTOTYPES: ENABLE |
12 |
|
13 |
int |
14 |
lirc_init(prog,verbose=0) |
15 |
char * prog |
16 |
int verbose |
17 |
|
18 |
int |
19 |
lirc_deinit() |
20 |
|
21 |
int |
22 |
lirc_readconfig(file=Nullch) |
23 |
char * file |
24 |
CODE: |
25 |
RETVAL = lirc_readconfig (file, &config, NULL); |
26 |
if (RETVAL != 0) |
27 |
config = 0; |
28 |
OUTPUT: |
29 |
RETVAL |
30 |
|
31 |
void |
32 |
lirc_freeconfig() |
33 |
CODE: |
34 |
if (config) |
35 |
lirc_freeconfig (config); |
36 |
|
37 |
void |
38 |
_get_code() |
39 |
PPCODE: |
40 |
char *code; |
41 |
|
42 |
if (lirc_nextcode (&code) != 0) |
43 |
croak ("communication error with lircd"); |
44 |
|
45 |
if (code) |
46 |
{ |
47 |
char *text; |
48 |
|
49 |
if (!config || lirc_code2char (config, code, &text) != 0) |
50 |
text = 0; |
51 |
|
52 |
XPUSHs (sv_2mortal (newSVpvn (code, 16))); |
53 |
if (text) |
54 |
XPUSHs (sv_2mortal (newSVpv (text, 0))); |
55 |
else |
56 |
XPUSHs (sv_2mortal (newSVpvn (code + 20, strchr (code + 20, ' ') - code - 20))); |
57 |
|
58 |
free (code); |
59 |
} |
60 |
|
61 |
|