support settning heartbeat inveral or reding params
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Oct 2020 08:23:38 +0000 (10:23 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 4 Oct 2020 08:23:38 +0000 (10:23 +0200)
zc-send

diff --git a/zc-send b/zc-send
index ff6a882..a048c7f 100755 (executable)
--- a/zc-send
+++ b/zc-send
@@ -21,15 +21,20 @@ if ( $path =~ m{$queue/(\w+)/} ) {
        die "can't find IMEI in $path\n";
 }
 
-my $raw = read_parameter_frame( "\x00" => "\x04\xe8\x03\x00\x00",
+my $raw;
+
+if ( $ARGV[0] eq m/interval/ ) {
+       # heartbeat interval
+       $raw = write_parameter_frame( "\x21" => "\x04" . pack('l',60) );
+
+} else {       
+       $raw = read_parameter_frame( "\x00" => "\x04\xe8\x03\x00\x00",
        "\x21",
        "\x44",
        "\x12",
        "\x14",
        "\x1a\x21\x22\x23\x24\x33\x34\x35\x3b" );
-
-# heartbeat interval
-my $raw = write_parameter_frame( "\x21" => "\x04" . pack('l',60) );
+}
 
 # temporary store to done
 my $t = time();