swixteen  0.03
Switch a lamp on/off with X10 RF commands
 All Files Functions Variables Macros Pages
SendX10Command.c
Go to the documentation of this file.
1 #include <stdio.h>
2 
3 #include "../MarmitekX10/MarmitekX10.h"
4 #include "../Commands/Commands.h"
5 #include "../Sysfs/Sysfs.h"
6 #include "../config.h"
7 
14 int main( int argc, char *argv[] )
15  {
16 
17  int Repeat=5; /* Number of times to send the command */
18  char *Name; /* Command to send */
19  int Index=0; /* Index to the name and codes */
20 
21  if( argc != 2)
22  {
23  fprintf(stderr, "Please provide me with an X10 command\n" );
24  fprintf(stderr, "eq A1on (uppercase/lowercase is important)\n" );
25  return(-1);
26  }
27 
28  Name=argv[1];
29 
30  Index=GetX10CommandsBy(Name); /* find the codes belonging to the given name */
31 
33 
34  while(Repeat--)
35  {
36  SendRfCode( Address[Index], Action[Index] );
37  }
38 
40 
41  return(0);
42  }