예제 #1
0
void json_sendResult(Serial *serial, const char *messageName, int resultCode)
{
    json_objStart(serial);
    json_objStartString(serial, messageName);
    json_int(serial, "rc", resultCode, 0);
    json_objEnd(serial, 0);
    json_objEnd(serial, 0);
}
void auto_logger_get_config(struct auto_logger_config* cfg,
                            struct Serial* serial,
                            const bool more)
{
        json_objStartString(serial, "autoLoggerCfg");
        json_bool(serial, "active", cfg->active, true);
        get_speed_time(serial, &cfg->start, "start", true);
        get_speed_time(serial, &cfg->stop, "stop", false);
        json_objEnd(serial, more);
}
static void get_speed_time(struct Serial* serial,
                           struct auto_logger_speed_time *alst,
                           const char* name,
                           const bool more)
{
        json_objStartString(serial, name);
        json_float(serial, "speed", alst->speed, 2, true);
        json_uint(serial, "time", alst->time, false);
        json_objEnd(serial, more);
}