Update reporter to accept an environment variable
This commit is contained in:
Родитель
dbfa316790
Коммит
37e2e4f597
|
@ -45,7 +45,8 @@ typedef enum ARGUEMENT_TYPE_TAG
|
|||
ARGUEMENT_TYPE_CMAKE_DIR,
|
||||
ARGUEMENT_TYPE_OUTPUT_FILE,
|
||||
ARGUEMENT_TYPE_SKIP_UPPER_LAYER,
|
||||
ARGUEMENT_TYPE_OUTPUT_TYPE
|
||||
ARGUEMENT_TYPE_OUTPUT_TYPE,
|
||||
ARGUEMENT_TYPE_CONN_STRING
|
||||
} ARGUEMENT_TYPE;
|
||||
|
||||
static const char* get_binary_file(PROTOCOL_TYPE type)
|
||||
|
@ -181,6 +182,9 @@ static int parse_command_line(int argc, char* argv[], BINARY_INFO* bin_info)
|
|||
case 't':
|
||||
argument_type = ARGUEMENT_TYPE_OUTPUT_TYPE;
|
||||
break;
|
||||
case 's':
|
||||
argument_type = ARGUEMENT_TYPE_CONN_STRING;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*if (argv[index][0] == '-' && (argv[index][1] == 'c' || argv[index][1] == 'C'))
|
||||
|
@ -226,6 +230,9 @@ static int parse_command_line(int argc, char* argv[], BINARY_INFO* bin_info)
|
|||
result = __LINE__;
|
||||
}
|
||||
break;
|
||||
case ARGUEMENT_TYPE_CONN_STRING:
|
||||
bin_info->azure_conn_string = argv[index];
|
||||
break;
|
||||
case ARGUEMENT_TYPE_UNKNOWN:
|
||||
default:
|
||||
result = __LINE__;
|
||||
|
@ -304,7 +311,7 @@ int main(int argc, char* argv[])
|
|||
(void)calculate_filesize(&bin_info, report_handle, PROTOCOL_AMQP, BINARY_UL_PATH_FMT);
|
||||
(void)calculate_filesize(&bin_info, report_handle, PROTOCOL_AMQP_WS, BINARY_UL_PATH_FMT);
|
||||
#endif
|
||||
report_write(report_handle, bin_info.output_file, NULL);
|
||||
report_write(report_handle, bin_info.output_file, bin_info.azure_conn_string);
|
||||
report_deinitialize(report_handle);
|
||||
result = 0;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ static REPORTER_TYPE g_report_type = REPORTER_TYPE_JSON;
|
|||
static const char* const UNKNOWN_TYPE = "unknown";
|
||||
static const char* const NODE_SDK_ANALYSIS = "sdkAnalysis";
|
||||
static const char* const NODE_BASE_ARRAY = "analysisItem";
|
||||
static const char* const SDK_ANALYSIS_EMPTY_NODE = "{ \"sdkAnalysis\" : { \"osType\": \"%s\", \"uploadEnabled\": \"%s\", \"logEnabled\": \"%s\", \"analysisItem\" : [] } }";
|
||||
static const char* const SDK_ANALYSIS_EMPTY_NODE = "{ \"sdkAnalysis\" : { \"osType\": \"%s\" \"version\": \"1.0.0\", \"uploadEnabled\": \"%s\", \"logEnabled\": \"%s\", \"analysisItem\" : [] } }";
|
||||
static const char* const NODE_OPERATING_SYSTEM = "osType";
|
||||
|
||||
static const char* const BINARY_SIZE_JSON_FMT = "{ \"type\": \"ROM\", \"dateTime\": \"%s\", \"feature\": \"%s\", \"layer\": \"%s\", \"version\": \"%s\", \"transport\" : \"%s\", \"binarySize\" : \"%s\" }";
|
||||
|
|
|
@ -89,6 +89,7 @@ typedef struct REPORT_INFO_TAG* REPORT_HANDLE;
|
|||
const char* cmake_dir;
|
||||
long binary_size;
|
||||
const char* output_file;
|
||||
const char* azure_conn_string;
|
||||
bool skip_ul;
|
||||
} BINARY_INFO;
|
||||
|
||||
|
@ -99,7 +100,7 @@ typedef struct REPORT_INFO_TAG* REPORT_HANDLE;
|
|||
extern void report_binary_sizes(REPORT_HANDLE handle, const BINARY_INFO* bin_info);
|
||||
extern void report_network_usage(REPORT_HANDLE handle, const MEM_ANALYSIS_INFO* iot_mem_info);
|
||||
|
||||
extern bool report_write(REPORT_HANDLE handle, const char* output_file);
|
||||
extern bool report_write(REPORT_HANDLE handle, const char* output_file, const char* conn_string);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -360,7 +360,7 @@ int main(int argc, char* argv[])
|
|||
platform_deinit();
|
||||
gbnetwork_deinit();
|
||||
|
||||
report_write(report_handle, NULL);
|
||||
report_write(report_handle, NULL, NULL);
|
||||
|
||||
report_deinitialize(report_handle);
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ int main(int argc, char* argv[])
|
|||
platform_deinit();
|
||||
gbnetwork_deinit();
|
||||
|
||||
report_write(report_handle, NULL);
|
||||
report_write(report_handle, NULL, NULL);
|
||||
|
||||
report_deinitialize(report_handle);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче