Skip to content

Commit 0397898

Browse files
committed
feat: add get_calibration command for Qorvo calibration queries
- New command: get_calibration (alias: get_calib) - Sends GID=0x0E (QORVO_MAC) OID=0x2B (GET_CALIBRATIONS) - Payload format: count(1) + [len(1)][name(len)] x N - Matches cherry-twr-app calibration query format - Registered in CLI_GROUP_SIMULATION The SET_APP_CONFIG format in the shell is already correct: session_id(4) + count(1) + [id(1)][len(1)][val(len)] x N Values are parsed by uci_config_parse_app_value with correct sizing.
1 parent 685be25 commit 0397898

3 files changed

Lines changed: 52 additions & 0 deletions

File tree

include/uci_cmd_simulation_typed.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@ int handle_simulate_multi_target_ranging_command_typed(const uci_cmd_dispatch_co
1717
const uci_param_def_t* params, int param_count);
1818
int handle_simulate_qm_sdk_vendor_command_typed(const uci_cmd_dispatch_context_t* dispatch_ctx, const char* cmd_name, int argc, char** argv,
1919
const uci_param_def_t* params, int param_count);
20+
int handle_get_calibration_command_typed(const uci_cmd_dispatch_context_t* dispatch_ctx, const char* cmd_name, int argc, char** argv,
21+
const uci_param_def_t* params, int param_count);
2022

2123
#endif

src/uci_cmd_framework_simulation.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@ const uci_command_def_t g_uci_simulation_command_defs[] = {
144144
.param_count = ARRAY_SIZE(k_vendor_command_params),
145145
.handler = handle_simulate_qm_sdk_vendor_command_typed,
146146
},
147+
{
148+
.name = "get_calibration",
149+
.aliases = { "get_calib", NULL },
150+
.group = CLI_GROUP_SIMULATION,
151+
.flags = CLI_CMD_FLAG_NONE,
152+
.description = "Query Qorvo calibration parameters (GID 0x0E OID 0x2B)",
153+
.params = NULL,
154+
.param_count = 0,
155+
.handler = handle_get_calibration_command_typed,
156+
},
147157
};
148158

149159
const int g_uci_simulation_command_defs_count =

src/uci_cmd_handlers_simulation.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,43 @@ int handle_simulate_qm_sdk_vendor_command_typed(const uci_cmd_dispatch_context_t
506506

507507
return 0;
508508
}
509+
510+
int handle_get_calibration_command_typed(const uci_cmd_dispatch_context_t* dispatch_ctx,
511+
const char* cmd_name,
512+
int argc,
513+
char** argv,
514+
const uci_param_def_t* params,
515+
int param_count) {
516+
(void)dispatch_ctx;
517+
(void)cmd_name;
518+
(void)params;
519+
(void)param_count;
520+
521+
int num_params = argc - 1;
522+
if (num_params <= 0) {
523+
printf("Usage: get_calibration <param_name> [param_name ...]\n");
524+
printf("Example: get_calibration ant0.port ant_set0.nb_rx_ants\n");
525+
return -1;
526+
}
527+
if (num_params > 255) {
528+
printf("Error: too many parameters (max 255)\n");
529+
return -1;
530+
}
531+
532+
unsigned char payload[1024];
533+
size_t offset = 0;
534+
payload[offset++] = (unsigned char)num_params;
535+
for (int i = 1; i < argc; i++) {
536+
size_t name_len = strlen(argv[i]);
537+
if (name_len == 0 || name_len > 255) {
538+
printf("Error: invalid param name length\n");
539+
return -1;
540+
}
541+
payload[offset++] = (unsigned char)name_len;
542+
memcpy(&payload[offset], argv[i], name_len);
543+
offset += name_len;
544+
}
545+
546+
send_uci_command(COMMAND, 0, 0x0E, 0x2B, payload, (int)offset);
547+
return 0;
548+
}

0 commit comments

Comments
 (0)