mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-20 09:26:37 +00:00
add /rssi page to rhizome web server to allow easy querying of
radio link budget.
This commit is contained in:
parent
610f7acdf8
commit
66956d84ce
@ -523,6 +523,15 @@ int rhizome_server_parse_http_request(rhizome_http_request *r)
|
||||
if (strcmp(path, "/favicon.ico") == 0) {
|
||||
r->request_type = RHIZOME_HTTP_REQUEST_FAVICON;
|
||||
rhizome_server_http_response_header(r, 200, "image/vnd.microsoft.icon", favicon_len);
|
||||
} else if (strcmp(path, "/rssi") == 0) {
|
||||
r->request_type = RHIZOME_HTTP_REQUEST_FROMBUFFER;
|
||||
char temp[8192];
|
||||
snprintf(temp,8192,
|
||||
"<head><meta http-equiv=\"refresh\" content=\"5\" >"
|
||||
"</head><html>Radio link margin = %+ddB<br>"
|
||||
"Radio temperature = %d°C</html>\n",
|
||||
last_radio_rssi,last_radio_temperature);
|
||||
rhizome_server_simple_http_response(r, 200, temp);
|
||||
} else if (strcmp(path, "/rhizome/groups") == 0) {
|
||||
/* Return the list of known groups */
|
||||
rhizome_server_sql_query_http_response(r, "id", "groups", "from groups", 32, 1);
|
||||
|
3
serval.h
3
serval.h
@ -856,5 +856,6 @@ int slip_decode(struct slip_decode_state *state);
|
||||
int upper7_decode(struct slip_decode_state *state,unsigned char byte);
|
||||
uint32_t Crc32_ComputeBuf( uint32_t inCrc32, const void *buf,
|
||||
size_t bufLen );
|
||||
|
||||
extern int last_radio_rssi;
|
||||
extern int last_radio_temperature;
|
||||
#endif // __SERVALD_SERVALD_H
|
||||
|
10
slip.c
10
slip.c
@ -149,7 +149,9 @@ int slip_encode(int format,
|
||||
|
||||
}
|
||||
|
||||
unsigned long long last_rssi_report=0;
|
||||
unsigned long long last_rssi_time=0;
|
||||
int last_radio_rssi=-999;
|
||||
int last_radio_temperature=-999;
|
||||
int parse_rfd900_rssi(char *s)
|
||||
{
|
||||
int lrssi,rrssi,lnoise,rnoise,temp;
|
||||
@ -161,10 +163,12 @@ int parse_rfd900_rssi(char *s)
|
||||
int lmargin=(lrssi-lnoise)/1.9;
|
||||
int rmargin=(lrssi-lnoise)/1.9;
|
||||
int maxmargin=lmargin; if (rmargin>maxmargin) maxmargin=rmargin;
|
||||
last_radio_rssi=maxmargin;
|
||||
last_radio_temperature=temp;
|
||||
|
||||
if (config.debug.packetradio||(gettime_ms()-last_rssi_report>30000)) {
|
||||
if (config.debug.packetradio||(gettime_ms()-last_rssi_time>30000)) {
|
||||
INFOF("Link budget = %ddB, temperature=%dC",maxmargin,temp);
|
||||
last_rssi_report=gettime_ms();
|
||||
last_rssi_time=gettime_ms();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user