mirror of
https://github.com/owntracks/recorder.git
synced 2026-08-27 16:57:21 +00:00
@@ -14,6 +14,10 @@ OTR_OBJS = json.o \
|
||||
util.o \
|
||||
storage.o
|
||||
|
||||
ifeq ($(HAVE_PING),yes)
|
||||
CFLAGS += -DHAVE_PING=1
|
||||
endif
|
||||
|
||||
ifeq ($(HAVE_LMDB),yes)
|
||||
CFLAGS += -DHAVE_LMDB=1 -Imdb/
|
||||
OTR_OBJS += gcache.o
|
||||
|
||||
@@ -84,6 +84,11 @@ The `monitor` file is located relative to STORE and contains a single line, the
|
||||
1439738692 owntracks/jjolie/ipad
|
||||
```
|
||||
|
||||
|
||||
If _recorder_ is built with `HAVE_PING` (default), a location publish to `owntracks/ping/ping` (i.e. username is `ping` and device is `ping`) can be used to round-trip-test the recorder. For this particular username/device combination, _recorder_ will store LAST position, but it will not keep a .REC file for it. This can be used to verify, say, via your favorite monitoring system, that the _recorder_ is still operational.
|
||||
|
||||
After sending a _pingping_, query the REST interface and deterrmine the difference in time.
|
||||
|
||||
## `ocat`
|
||||
|
||||
_ocat_ is a CLI driver for _recorder_: it prints data stored by the _recorder_ in a variety of output formats.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Select features
|
||||
HAVE_HTTP ?= yes
|
||||
HAVE_LMDB ?= yes
|
||||
HAVE_PING ?= yes
|
||||
|
||||
STORAGEDEFAULT = "./store"
|
||||
|
||||
|
||||
@@ -164,6 +164,9 @@ void print_versioninfo()
|
||||
#endif
|
||||
#ifdef HAVE_HTTP
|
||||
printf("\tHAVE_HTTP = yes\n");
|
||||
#endif
|
||||
#ifdef HAVE_PING
|
||||
printf("\tHAVE_PING = yes\n");
|
||||
#endif
|
||||
printf("\tSTORAGEDEFAULT = \"%s\"\n", STORAGEDEFAULT);
|
||||
printf("\tGEOHASH_PREC = %d\n", GEOHASH_PREC);
|
||||
|
||||
+14
-7
@@ -371,6 +371,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
static UT_string *reltopic = NULL;
|
||||
char *jsonstring;
|
||||
time_t now;
|
||||
int pingping = FALSE;
|
||||
|
||||
/*
|
||||
* mosquitto_message->
|
||||
@@ -411,6 +412,12 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
utstring_printf(username, "%s", topics[1]);
|
||||
utstring_printf(device, "%s", topics[2]);
|
||||
|
||||
#ifdef HAVE_PING
|
||||
if (!strcmp(utstring_body(username), "ping") && !strcmp(utstring_body(device), "ping")) {
|
||||
pingping = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((count == TOPIC_PARTS) && (strcmp(topics[count-1], TOPIC_SUFFIX) == 0)) {
|
||||
if (do_info(ud, username, device, m->payload) == TRUE) { /* this was a card */
|
||||
return;
|
||||
@@ -546,7 +553,7 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
*/
|
||||
|
||||
#ifdef HAVE_HTTP
|
||||
if (ud->mgserver) {
|
||||
if (ud->mgserver && !pingping) {
|
||||
|
||||
/*
|
||||
* Create a new location object containing all the bits and
|
||||
@@ -595,13 +602,13 @@ void on_message(struct mosquitto *mosq, void *userdata, const struct mosquitto_m
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((fp = pathn("a", "rec", username, device, "rec")) != NULL) {
|
||||
|
||||
fprintf(fp, RECFORMAT, isotime(now), "*", jsonstring);
|
||||
fclose(fp);
|
||||
if (!pingping) {
|
||||
if ((fp = pathn("a", "rec", username, device, "rec")) != NULL) {
|
||||
fprintf(fp, RECFORMAT, isotime(now), "*", jsonstring);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Keep track of original username & device name in LAST. */
|
||||
json_append_member(json, "username", json_mkstring(utstring_body(username)));
|
||||
json_append_member(json, "device", json_mkstring(utstring_body(device)));
|
||||
@@ -740,7 +747,7 @@ int main(int argc, char **argv)
|
||||
udata.gc = NULL;
|
||||
#endif
|
||||
#ifdef HAVE_HTTP
|
||||
udata.mgserver = NULL;
|
||||
udata.mgserver = NULL;
|
||||
#endif
|
||||
|
||||
if ((p = getenv("OTR_HOST")) != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user