Improve JSON readability a bit.
This commit is contained in:
6
json.c
6
json.c
@@ -12,7 +12,7 @@ void json_init() {
|
|||||||
|
|
||||||
static size_t json_hello(char *buf) {
|
static size_t json_hello(char *buf) {
|
||||||
int len = snprintf(buf, SERIALIZE_LEN,
|
int len = snprintf(buf, SERIALIZE_LEN,
|
||||||
"{\"mlat_timestamp_mhz\":%ju,\"mlat_timestamp_max\":%ju,\"rssi_max\":%ju}\n",
|
"{\"mlat_timestamp_mhz\":%ju, \"mlat_timestamp_max\":%ju, \"rssi_max\":%ju}\n",
|
||||||
(uintmax_t) MLAT_MHZ,
|
(uintmax_t) MLAT_MHZ,
|
||||||
(uintmax_t) MLAT_MAX,
|
(uintmax_t) MLAT_MAX,
|
||||||
(uintmax_t) RSSI_MAX);
|
(uintmax_t) RSSI_MAX);
|
||||||
@@ -24,7 +24,7 @@ static size_t json_serialize_mode_s_short(struct packet *packet, char *buf) {
|
|||||||
char hexbuf[14];
|
char hexbuf[14];
|
||||||
hex_from_bin(hexbuf, packet->payload, 7);
|
hex_from_bin(hexbuf, packet->payload, 7);
|
||||||
int len = snprintf(buf, SERIALIZE_LEN,
|
int len = snprintf(buf, SERIALIZE_LEN,
|
||||||
"{\"payload\":\"%.14s\",\"mlat_timestamp\":%ju,\"rssi\":%ju}\n",
|
"{\"payload\":\"%.14s\", \"mlat_timestamp\":%ju, \"rssi\":%ju}\n",
|
||||||
hexbuf,
|
hexbuf,
|
||||||
(uintmax_t) packet->mlat_timestamp,
|
(uintmax_t) packet->mlat_timestamp,
|
||||||
(uintmax_t) packet->rssi);
|
(uintmax_t) packet->rssi);
|
||||||
@@ -36,7 +36,7 @@ static size_t json_serialize_mode_s_long(struct packet *packet, char *buf) {
|
|||||||
char hexbuf[28];
|
char hexbuf[28];
|
||||||
hex_from_bin(hexbuf, packet->payload, 14);
|
hex_from_bin(hexbuf, packet->payload, 14);
|
||||||
int len = snprintf(buf, SERIALIZE_LEN,
|
int len = snprintf(buf, SERIALIZE_LEN,
|
||||||
"{\"payload\":\"%.28s\",\"mlat_timestamp\":%ju,\"rssi\":%ju}\n",
|
"{\"payload\":\"%.28s\", \"mlat_timestamp\":%ju, \"rssi\":%ju}\n",
|
||||||
hexbuf,
|
hexbuf,
|
||||||
(uintmax_t) packet->mlat_timestamp,
|
(uintmax_t) packet->mlat_timestamp,
|
||||||
(uintmax_t) packet->rssi);
|
(uintmax_t) packet->rssi);
|
||||||
|
|||||||
Reference in New Issue
Block a user