rc433/send.c

changeset 25
5e0695f6add5
parent 23
d820a6f3ec16
child 29
ac763b87ee25
--- a/rc433/send.c	Mon May 05 13:49:53 2014 +0200
+++ b/rc433/send.c	Mon May 05 20:25:20 2014 +0200
@@ -32,7 +32,8 @@
     fprintf(stdout, "       send -t A -g 00001 -d 00001 -s 1\n");
     fprintf(stdout, "       send -t B -g 2 -d 2 -s 0\n");
     fprintf(stdout, "       send -t C -f c -g 3 -d 3 -s 1\n");
-    fprintf(stdout, "       send -t D -g A -d 2 -s 0\n");
+    fprintf(stdout, "\n");
+    fprintf(stdout, "       send -t E -g A -d 2 -s 0\n");
 }
 
 
@@ -118,8 +119,8 @@
     /*
      * Check all option and combinations
      */
-    if ((cType < 'A') || (cType > 'D')) {
-	fprintf(stderr, "Type must be A, B, C or D\n");
+    if ((cType < 'A') || (cType > 'E')) {
+	fprintf(stderr, "Type must be A, B, C or E\n");
 	return 1;
     }
     if ((iState < 0) || (iState > 1)) {
@@ -163,7 +164,7 @@
 	    return 1;
 	}
     }
-    if (cType == 'D') {
+    if (cType == 'E') {
 	if ((iDevice < 1) || (iDevice > 3)) {
 	    fprintf(stderr, "Device must be 1..3\n");
     	    return 1;
@@ -194,31 +195,19 @@
     switch (cType) {
 	case 'A':
 		    printf("Type A sending group[%s] device[%s] command[%d]\n", sGroup, sDevice, iState);
-		    if (iState)
-			switchOn_A(sGroup, sDevice);
-		    else
-			switchOff_A(sGroup, sDevice);
+		    toggleTypeA(sGroup, sDevice, iState);
 		    break;
 	case 'B':
 		    printf("Type B sending group[%d] device[%i] command[%i]\n", iGroup, iDevice, iState);
-		    if (iState)
-			switchOn_B(iGroup, iDevice);
-		    else
-			switchOff_B(iGroup, iDevice);
+		    toggleTypeB(iGroup, iDevice, iState);
 		    break;
 	case 'C':
 		    printf("Type C sending family[%c] group[%d] device[%i] command[%i]\n", cFamily, iGroup, iDevice, iState);
-		    if (iState)
-			switchOn_C(cFamily, iGroup, iDevice);
-		    else
-			switchOff_C(cFamily, iGroup, iDevice);
+		    toggleTypeC(cFamily, iGroup, iDevice, iState);
 		    break;
-	case 'D':
-		    printf("Type D sending group[%c] device[%i] command[%i]\n", cGroup, iDevice, iState);
-		    if (iState)
-			switchOn_D(cGroup, iDevice);
-		    else
-			switchOff_D(cGroup, iDevice);
+	case 'E':
+		    printf("Type E sending group[%c] device[%i] command[%i]\n", cGroup, iDevice, iState);
+		    toggleTypeE(cGroup, iDevice, iState);
 		    break;
     }
     disableTransmit();

mercurial