-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
159 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <json-c/json.h> | ||
|
||
#include <respondd.h> | ||
|
||
#include "ffffm.h" | ||
|
||
static struct json_object *get_nexthop(void) { | ||
struct json_object *ret; | ||
char *nexthop_s; | ||
|
||
nexthop_s = ffffm_get_nexthop(); | ||
if (!nexthop_s) | ||
return NULL; | ||
|
||
ret = json_object_new_string(nexthop_s); | ||
free(nexthop_s); | ||
return ret; | ||
} | ||
|
||
static struct json_object *respondd_provider_statistics(void) { | ||
struct json_object *ret = json_object_new_object(); | ||
|
||
if (!ret) | ||
return NULL; | ||
|
||
struct json_object *nexthop; | ||
|
||
nexthop = get_nexthop(); | ||
if (nexthop) | ||
json_object_object_add(ret, "nexthop", nexthop); | ||
|
||
return ret; | ||
} | ||
|
||
const struct respondd_provider_info respondd_providers[] = { | ||
{"statistics", respondd_provider_statistics}, | ||
{0}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include <string.h> | ||
|
||
#include <json-c/json.h> | ||
|
||
#include <respondd.h> | ||
|
||
#include "ffffm.h" | ||
|
||
static struct json_object *get_airtime(void) { | ||
double airtime = ffffm_get_airtime(); | ||
if (FFFFM_INVALID_AIRTIME == airtime) | ||
return NULL; | ||
|
||
return json_object_new_double(airtime); | ||
} | ||
|
||
static struct json_object *respondd_provider_statistics(void) { | ||
struct json_object *ret = json_object_new_object(); | ||
|
||
if (!ret) | ||
return NULL; | ||
|
||
struct json_object *airtime; | ||
|
||
airtime = get_airtime(); | ||
if (airtime) | ||
json_object_object_add(ret, "airtime2", airtime); | ||
|
||
return ret; | ||
} | ||
|
||
static struct json_object *respondd_provider_nodeinfo(void) { | ||
struct ffffm_wifi_info *i = ffffm_get_wifi_info(); | ||
if (!i) | ||
goto end; | ||
|
||
struct json_object *ret = json_object_new_object(); | ||
struct json_object *v; | ||
if (!ret) | ||
goto end; | ||
|
||
if (i->c24) { | ||
v = json_object_new_int64(i->c24); | ||
if (!v) | ||
goto end; | ||
json_object_object_add(ret, "chan2", v); | ||
} | ||
if (i->c50) { | ||
v = json_object_new_int64(i->c50); | ||
if (!v) | ||
goto end; | ||
json_object_object_add(ret, "chan5", v); | ||
} | ||
if (i->t24) { | ||
v = json_object_new_int64(i->t24); | ||
if (!v) | ||
goto end; | ||
json_object_object_add(ret, "txpower2", v); | ||
} | ||
if (i->t50) { | ||
v = json_object_new_int64(i->t50); | ||
if (!v) | ||
goto end; | ||
json_object_object_add(ret, "txpower5", v); | ||
} | ||
end: | ||
free(i); | ||
return ret; | ||
|
||
} | ||
|
||
|
||
const struct respondd_provider_info respondd_providers[] = { | ||
{"statistics", respondd_provider_statistics}, | ||
{"nodeinfo", respondd_provider_nodeinfo}, | ||
{0}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters