Migration: support bluetooth and board

This commit is contained in:
李通洲
2023-10-23 16:34:33 +08:00
parent a7621a7301
commit be2af8aeaf
2 changed files with 21 additions and 2 deletions
+12 -1
View File
@@ -112,6 +112,17 @@ void ffParseBluetoothJsonObject(FFBluetoothOptions* options, yyjson_val* module)
}
}
void ffGenerateBluetoothJsonConfig(FFBluetoothOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
__attribute__((__cleanup__(ffDestroyBluetoothOptions))) FFBluetoothOptions defaultOptions;
ffInitBluetoothOptions(&defaultOptions);
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
if (options->showDisconnected != defaultOptions.showDisconnected)
yyjson_mut_obj_add_bool(doc, module, "showDisconnected", options->showDisconnected);
}
void ffGenerateBluetoothJsonResult(FF_MAYBE_UNUSED FFBluetoothOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
FF_LIST_AUTO_DESTROY results = ffListCreate(sizeof(FFBluetoothResult));
@@ -165,7 +176,7 @@ void ffInitBluetoothOptions(FFBluetoothOptions* options)
ffPrintBluetooth,
ffGenerateBluetoothJsonResult,
ffPrintBluetoothHelpFormat,
NULL
ffGenerateBluetoothJsonConfig
);
ffOptionInitModuleArg(&options->moduleArgs);
options->showDisconnected = false;
+9 -1
View File
@@ -76,6 +76,14 @@ void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module)
}
}
void ffGenerateBoardJsonConfig(FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
__attribute__((__cleanup__(ffDestroyBoardOptions))) FFBoardOptions defaultOptions;
ffInitBoardOptions(&defaultOptions);
ffJsonConfigGenerateModuleArgsConfig(doc, module, &defaultOptions.moduleArgs, &options->moduleArgs);
}
void ffGenerateBoardJsonResult(FF_MAYBE_UNUSED FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
{
FFBoardResult board;
@@ -127,7 +135,7 @@ void ffInitBoardOptions(FFBoardOptions* options)
ffPrintBoard,
ffGenerateBoardJsonResult,
ffPrintBoardHelpFormat,
NULL
ffGenerateBoardJsonConfig
);
ffOptionInitModuleArg(&options->moduleArgs);
}