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