|
11 | 11 | * Originally based on the SeedLink interface of the modified Comserv in |
12 | 12 | * SeisComP written by Andres Heinloo |
13 | 13 | * |
14 | | - * Version: 2010.069 |
| 14 | + * Version: 2010.075 |
15 | 15 | ***************************************************************************/ |
16 | 16 |
|
17 | 17 | #include <stdio.h> |
@@ -938,13 +938,13 @@ sl_sayhello (SLCD * slconn) |
938 | 938 | char *extreply = 0; |
939 | 939 |
|
940 | 940 | /* Current capabilities: |
941 | | - * SLPROTO:3.0 = SeedLink protocol version 3.0 |
| 941 | + * SLPROTO:3.1 = SeedLink protocol version |
942 | 942 | * CAP = CAPABILITIES command support |
943 | 943 | * EXTREPLY = Extended reply message handling |
944 | 944 | * NSWILDCARD = Network and station code wildcard support |
945 | 945 | * BATCH = BATCH command mode support |
946 | 946 | */ |
947 | | - sprintf (sendstr, "CAPABILITIES SLPROTO:3.0 CAP EXTREPLY NSWILDCARD BATCH\r"); |
| 947 | + sprintf (sendstr, "CAPABILITIES SLPROTO:3.1 CAP EXTREPLY NSWILDCARD BATCH\r"); |
948 | 948 |
|
949 | 949 | /* Send CAPABILITIES and recv response */ |
950 | 950 | sl_log_r (slconn, 1, 2, "[%s] sending: %s\n", slconn->sladdr, sendstr); |
@@ -995,22 +995,33 @@ sl_sayhello (SLCD * slconn) |
995 | 995 | /*************************************************************************** |
996 | 996 | * sl_batchmode: |
997 | 997 | * |
998 | | - * Send the BATCH command |
| 998 | + * Send the BATCH command to switch the connection to batch command |
| 999 | + * mode, in this mode the server will not send acknowledgments (OK or |
| 1000 | + * ERROR) after recognized commands are submitted. |
999 | 1001 | * |
1000 | 1002 | * Returns -1 on errors, 0 on success (regardless if the command was accepted). |
1001 | 1003 | * Sets slconn->batchmode accordingly. |
1002 | 1004 | ***************************************************************************/ |
1003 | 1005 | int |
1004 | 1006 | sl_batchmode (SLCD * slconn) |
1005 | 1007 | { |
1006 | | - /* Enter batchmode if supported by server */ |
1007 | | - char sendstr[100]; /* A buffer for command strings */ |
1008 | | - char readbuf[100]; |
| 1008 | + char sendstr[100]; /* A buffer for command strings */ |
| 1009 | + char readbuf[100]; /* A buffer for server reply */ |
1009 | 1010 | int bytesread = 0; |
1010 | 1011 |
|
1011 | | - sprintf (sendstr, "BATCH\r"); |
| 1012 | + if ( ! slconn ) |
| 1013 | + return -1; |
| 1014 | + |
| 1015 | + if (sl_checkversion (slconn, 3.1) < 0) |
| 1016 | + { |
| 1017 | + sl_log_r (slconn, 2, 0, |
| 1018 | + "[%s] detected SeedLink version (%.3f) does not support the BATCH command\n", |
| 1019 | + slconn->sladdr, slconn->protocol_ver); |
| 1020 | + return -1; |
| 1021 | + } |
1012 | 1022 |
|
1013 | 1023 | /* Send BATCH and recv response */ |
| 1024 | + sprintf (sendstr, "BATCH\r"); |
1014 | 1025 | sl_log_r (slconn, 1, 2, "[%s] sending: %s\n", slconn->sladdr, sendstr); |
1015 | 1026 | bytesread = sl_senddata (slconn, (void *) sendstr, strlen (sendstr), slconn->sladdr, |
1016 | 1027 | readbuf, sizeof (readbuf)); |
|
0 commit comments