From 4291327d6527d546d51b69db551248809dc5cb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B3=A5=E5=B0=8F=E5=89=91=E5=85=B3?= Date: Wed, 5 Jun 2024 07:41:04 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9PCID=E4=BB=A5=E5=8F=8ARPC?= =?UTF-8?q?ID=E5=A4=A7=E5=86=99=E4=B8=BA=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 青泥小剑关 --- BUILD.gn | 10 +++--- README.md | 14 ++++---- README_ZH.md | 46 ++++++++++++------------- RELEASE-NOTE.txt | 2 +- interfaces/inner_api/syscap_interface.c | 6 ++-- src/create_pcid.c | 8 ++--- src/main.c | 10 +++--- src/syscap_tool.c | 6 ++-- 8 files changed, 51 insertions(+), 51 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index f9d2aee..6d7e3d2 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -137,7 +137,7 @@ group("syscap_tool_bin_linux") { } build_ext_component("generate_pcid") { - outputs = [ "$root_out_dir/PCID.sc" ] + outputs = [ "$root_out_dir/pcid.sc" ] deps = [ ":syscap_tool_bin_linux" ] exec_path = rebase_path(root_out_dir) preload_path = rebase_path(preloader_output_dir) @@ -150,13 +150,13 @@ build_ext_component("generate_pcid") { command += " && $cmd -P -e -i ${preload_path}/system/etc/SystemCapability.json" if (defined(ohos_lite)) { - command += " && mkdir -p $exec_path/system/etc && cp $exec_path/PCID.sc $exec_path/system/etc/PCID.sc" + command += " && mkdir -p $exec_path/system/etc && cp $exec_path/pcid.sc $exec_path/system/etc/pcid.sc" } } -ohos_prebuilt_etc("PCID.sc") { +ohos_prebuilt_etc("pcid.sc") { deps = [ ":generate_pcid" ] - source = "$root_out_dir/PCID.sc" + source = "$root_out_dir/pcid.sc" subsystem_name = "developtools" part_name = "syscap_codec" } @@ -182,7 +182,7 @@ if (syscap_codec_config_extern_path != "") { } group("pcid_sc") { - deps = [ ":PCID.sc" ] + deps = [ ":pcid.sc" ] } group("syscap_codec") { diff --git a/README.md b/README.md index 005c7bc..4ca90a9 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,17 @@ SysCap(SystemCapability) encoder and decoder tools common usage scenarios as follow: -APP development: IDE collect APP required SysCap and API verssion as in RPCID encoder input. And IDE will decode PCID to device SysCap list when it imported. This tool is only for use by the IDE, developers will not be used directly. +APP development: IDE collect APP required SysCap and API verssion as in rpcid encoder input. And IDE will decode pcid to device SysCap list when it imported. This tool is only for use by the IDE, developers will not be used directly. Main function: -1. PCID Encode: Encode SysCap list to PCID. +1. pcid Encode: Encode SysCap list to pcid. -2. PCID Decode: Decode PCID to get system SysCap list. +2. pcid Decode: Decode pcid to get system SysCap list. -3. RPCID Encode: Encode APP required SysCap list to RPCID. +3. rpcid Encode: Encode APP required SysCap list to rpcid. -4. RPCID Decode: Decode RPCID to get APP required SysCap list. +4. rpcid Decode: Decode rpcid to get APP required SysCap list. ## File Structure @@ -69,9 +69,9 @@ SysCap tools usually integrate to IDE, APP store and bundle tools. Follow instru -h, --help : how to use --R, --RPCID : encode or decode RPCID +-R, --rpcid : encode or decode rpcid --P, --PCID : encode or decode PCID +-P, --pcid : encode or decode pcid -e, --encode : to encode diff --git a/README_ZH.md b/README_ZH.md index b39cfbc..f992f1e 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -2,21 +2,21 @@ 系统能力(SystemCapability, 本文中使用SysCap缩写)编解码工具应用场景如下: -应用开发时,IDE会根据应用配置的SysCap和API版本生成描述RPCID(Required Product Compatibility ID)的json文件,并调用编解码工具syscap_tool将该json文件编码成RPCID。另一方面,IDE拿到开发者导入PCID(Product Compatibility ID),使用该工具解码出设备的SysCap集合。该工具仅供IDE使用,对用户不可见。 +应用开发时,IDE会根据应用配置的SysCap和API版本生成描述rpcid(Required Product Compatibility ID)的json文件,并调用编解码工具syscap_tool将该json文件编码成rpcid。另一方面,IDE拿到开发者导入pcid(Product Compatibility ID),使用该工具解码出设备的SysCap集合。该工具仅供IDE使用,对用户不可见。 提供的主要功能: -1. PCID编码:对描述SysCap集合的文件编码生成PCID。 +1. pcid编码:对描述SysCap集合的文件编码生成pcid。 -2. PCID解码:对编码后的PCID文件解码获取SysCap集合。 +2. pcid解码:对编码后的pcid文件解码获取SysCap集合。 -3. RPCID编码:对描述应用所需的SysCap集合的文件编码生成RPCID。 +3. rpcid编码:对描述应用所需的SysCap集合的文件编码生成rpcid。 -4. RPCID解码:对编码后的RPCID文件解码获取应用所需的SysCap集合。 +4. rpcid解码:对编码后的rpcid文件解码获取应用所需的SysCap集合。 -5. 编码字符串:将sc后缀形式的PCID/RPCID编码为字符串形式。 +5. 编码字符串:将sc后缀形式的pcid/rpcid编码为字符串形式。 -6. PCID与RPCID比较:查询PCID是否满足RPCID的要求,并输出不满足的地方。 +6. pcid与rpcid比较:查询pcid是否满足rpcid的要求,并输出不满足的地方。 ## 代码目录 ``` @@ -72,8 +72,8 @@ syscap_tool PC端可执行文件编译步骤: ```shell syscap_tool -R/P -e/d -i filepath [-o outpath] -h, --help : how to use --R, --RPCID : encode or decode RPCID --P, --PCID : encode or decode PCID +-R, --rpcid : encode or decode rpcid +-P, --pcid : encode or decode pcid -C, --compare : compare pcid with rpcid string format. -s, --string : input string. -e, --encode : encode to sc format. @@ -88,31 +88,31 @@ syscap_tool v1.1.1 ``` ### 使用示例 ```shell -# 将 RPCID.json 编码为SC格式,文件名RPCID.sc -syscap_tool -Rei RPCID.json -o path/ +# 将 rpcid.json 编码为SC格式,文件名rpcid.sc +syscap_tool -Rei rpcid.json -o path/ -# 将 RPCID.sc 编码为JSON格式,文件名RPCID.json -syscap_tool -Rdi RPCID.sc -o path/ +# 将 rpcid.sc 编码为JSON格式,文件名rpcid.json +syscap_tool -Rdi rpcid.sc -o path/ -# 将 PCID.json 编码为SC格式,文件名PCID.sc -syscap_tool -Pei PCID.json -o path/ +# 将 pcid.json 编码为SC格式,文件名pcid.sc +syscap_tool -Pei pcid.json -o path/ -# 将 PCID.sc 编码为JSON格式,文件名PCID.json -syscap_tool -Pdi PCID.sc -o path/ +# 将 pcid.sc 编码为JSON格式,文件名pcid.json +syscap_tool -Pdi pcid.sc -o path/ -# 将 RPCID.sc 编码为字符串格式,文件名RPCID.txt -syscap_tool -Resi RPCID.sc -o path/ +# 将 rpcid.sc 编码为字符串格式,文件名rpcid.txt +syscap_tool -Resi rpcid.sc -o path/ -# 将 PCID.sc 编码为字符串格式,文件名PCID.txt -syscap_tool -Pesi PCID.sc -o path/ +# 将 pcid.sc 编码为字符串格式,文件名pcid.txt +syscap_tool -Pesi pcid.sc -o path/ -# 比较字符串格式的PCID和RPCID,pcid 符合条件返回成功提示,不符合则提示原因。 +# 比较字符串格式的pcid和rpcid,pcid 符合条件返回成功提示,不符合则提示原因。 syscap_tool -C pcid.txt rpcid.txt # 功能类似 -C 选项,区别为 -SC 选项为直接输入字符串。 syscap_tool -sC "pcidstring" "rpcidstring" -# 将字符串格式的 pcid 转为 json 格式,文件名 PCID.json。 +# 将字符串格式的 pcid 转为 json 格式,文件名 pcid.json。 syscap_tool -Pdsi pcid.txt -o path/ ``` **说明:** -o 选项指定输出目录,缺省为当前目录。 diff --git a/RELEASE-NOTE.txt b/RELEASE-NOTE.txt index 7a8e370..2bc6e3e 100644 --- a/RELEASE-NOTE.txt +++ b/RELEASE-NOTE.txt @@ -1,5 +1,5 @@ v2.0.0 reorganize syscap define. v1.1.2 add syscap "SystemCapability.ArkUI.UiAppearance". v1.1.1 add compare string pcid with rpcid function. -v1.1.0 add encode/decode string format PCID/RPCID. +v1.1.0 add encode/decode string format pcid/rpcid. v1.0.0 first release. \ No newline at end of file diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 00954b1..c70d560 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -57,7 +57,7 @@ typedef struct ProductCompatibilityID { uint8_t osSyscap[OS_SYSCAP_BYTES]; } PCIDMain; -static const char *PCID_PATH = "/system/etc/PCID.sc"; +static const char *PCID_PATH = "/system/etc/pcid.sc"; struct FreeAfterDecodeRpcidInfo { char *priSyscap; @@ -91,7 +91,7 @@ bool EncodeOsSyscap(char *output, int len) ret = GetFileContext(PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { - PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); + PRINT_ERR("GetFileContext failed, input file : /system/etc/pcid.sc\n"); return false; } @@ -115,7 +115,7 @@ bool EncodePrivateSyscap(char **output, int *outputLen) ret = GetFileContext(PCID_PATH, &contextBuffer, &bufferLen); if (ret != 0) { - PRINT_ERR("GetFileContext failed, input file : /system/etc/PCID.sc\n"); + PRINT_ERR("GetFileContext failed, input file : /system/etc/pcid.sc\n"); return false; } diff --git a/src/create_pcid.c b/src/create_pcid.c index 2c9da93..2157b22 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -213,7 +213,7 @@ int32_t GetPriSyscapLen(uint32_t privateCapSize, cJSON *jsonPriSyscapObj, uint16 static int32_t CheckConvertedContextSaveAsFile(char *outDirPath, PCIDMain *pcidBuffer, uint16_t pcidLength, int32_t ret) { - const char pcidFileName[] = "PCID.sc"; + const char pcidFileName[] = "pcid.sc"; ret = ConvertedContextSaveAsFile(outDirPath, pcidFileName, (char *)pcidBuffer, pcidLength); if (ret != 0) { PRINT_ERR("Save as file failed, outDirPath:%s, filename:%s\n", outDirPath, pcidFileName); @@ -525,7 +525,7 @@ int32_t DecodePCID(char *inputFile, char *outDirPath) freePcidJsonInfo.sysCapObj = NULL; // avoid being released repeatedly. char *strJson = cJSON_Print(freePcidJsonInfo.jsonRootObj); - const char outputFileName[] = "PCID.json"; + const char outputFileName[] = "pcid.json"; ret = ConvertedContextSaveAsFile(outDirPath, outputFileName, strJson, strlen(strJson)); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", outDirPath, outputFileName); @@ -746,7 +746,7 @@ int32_t DecodeStringPCIDToJson(char *input, char *outDirPath) PRINT_ERR("json buffer is null.\n"); goto ADD_JSON_FAILED; } - const char outputFileName[] = "PCID.json"; + const char outputFileName[] = "pcid.json"; if (ConvertedContextSaveAsFile(outDirPath, outputFileName, jsonBuffer, strlen(jsonBuffer)) != 0) { PRINT_ERR("Save as json file failed.\n"); @@ -817,7 +817,7 @@ static int32_t GetEncodePCIDOut(uint16_t priSyscapCount, uint32_t privateSyscapL } } // save as file - const char outputFileName[] = "PCID.txt"; + const char outputFileName[] = "pcid.txt"; ret = ConvertedContextSaveAsFile(freePcidInfo.outDirPathFinal, outputFileName, output, strlen(output)); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outDirPath:%s, filename:%s\n", diff --git a/src/main.c b/src/main.c index 388dc1d..44fd992 100644 --- a/src/main.c +++ b/src/main.c @@ -51,8 +51,8 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath); static struct option g_longOptions[] = { {"help", no_argument, 0, 'h' }, {"version", no_argument, 0, 'v' }, - {"RPCID", no_argument, 0, 'R' }, - {"PCID", no_argument, 0, 'P' }, + {"rpcid", no_argument, 0, 'R' }, + {"pcid", no_argument, 0, 'P' }, {"compare", required_argument, 0, 'C' }, {"encode", no_argument, 0, 'e' }, {"decode", no_argument, 0, 'd' }, @@ -112,7 +112,7 @@ int32_t OperateByBitMap(char *const *argv, uint16_t bitMap, char *outputpath) ret = EncodeRpcidscToString(g_customerfileinfo.inputfile, outputpath); break; case 0x115: // 0x115, -Pesi inputfile ret = EncodePcidscToString(g_customerfileinfo.inputfile, outputpath); break; - case 0x60: // 0x60, -C PCID.txt RPCID.txt + case 0x60: // 0x60, -C pcid.txt rpcid.txt ret = ComparePcidWithRpcidString(g_customerfileinfo.pcidfile, g_customerfileinfo.rpcidfile, TYPE_FILE); break; case 0x64: // 0x64, -sC "pcidstring" "rpcidstring" @@ -195,8 +195,8 @@ void PrintHelp(void) { printf("syscap_tool -R/P -e/d -i filepath [-o outpath]\n"); printf("-h, --help\t: how to use\n"); - printf("-R, --RPCID\t: encode or decode RPCID\n"); - printf("-P, --PCID\t: encode or decode PCID\n"); + printf("-R, --rpcid\t: encode or decode rpcid\n"); + printf("-P, --pcid\t: encode or decode pcid\n"); printf("-C, --compare\t: compare pcid with rpcid string format.\n\t" "-s, --string : input string.\n"); printf("-e, --encode\t: encode to sc format.\n\t-s, --string : encode to string format.\n"); diff --git a/src/syscap_tool.c b/src/syscap_tool.c index cc6051c..e7b1314 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -179,7 +179,7 @@ int32_t RPCIDEncode(char *inputFile, char *outputPath) if (ret == -1) { return FreeAfterRPCIDEncode(convertedBuffer, contextBuffer, FREE_CONVERT_OUT_RPCID_ENCODE, ret); } - ret = ConvertedContextSaveAsFile(outputPath, "RPCID.sc", convertedBuffer, convertedBufLen); + ret = ConvertedContextSaveAsFile(outputPath, "rpcid.sc", convertedBuffer, convertedBufLen); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.sc\n", outputPath); } @@ -258,7 +258,7 @@ int32_t RPCIDDecode(char *inputFile, char *outputPath) // save to json file convertedBuffer = cJSON_Print(rpcidRoot); - ret = ConvertedContextSaveAsFile(outputPath, "RPCID.json", convertedBuffer, strlen(convertedBuffer)); + ret = ConvertedContextSaveAsFile(outputPath, "rpcid.json", convertedBuffer, strlen(convertedBuffer)); if (ret != 0) { PRINT_ERR("ConvertedContextSaveAsFile failed, outputPath:%s, filename:rpcid.json\n", outputPath); free(convertedBuffer); @@ -335,7 +335,7 @@ static int32_t PrintOutputToFile(struct FreeAfterEncodeRpcidscInfo freeAfterEnco } } - const char outputFilename[] = "RPCID.txt"; + const char outputFilename[] = "rpcid.txt"; ret = ConvertedContextSaveAsFile(outDirPath, outputFilename, freeAfterEncodeRpcidscInfo.outBuffer, strlen(freeAfterEncodeRpcidscInfo.outBuffer)); if (ret != 0) { -- Gitee From b7a357bf1100ba507366a1c8d7f302b4ade28126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9D=92=E6=B3=A5=E5=B0=8F=E5=89=91=E5=85=B3?= Date: Wed, 5 Jun 2024 08:04:59 +0000 Subject: [PATCH 2/2] update README_ZH.md. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 青泥小剑关 --- README_ZH.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_ZH.md b/README_ZH.md index f992f1e..b86e02b 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -109,7 +109,7 @@ syscap_tool -Pesi pcid.sc -o path/ # 比较字符串格式的pcid和rpcid,pcid 符合条件返回成功提示,不符合则提示原因。 syscap_tool -C pcid.txt rpcid.txt -# 功能类似 -C 选项,区别为 -SC 选项为直接输入字符串。 +# 功能类似 -C 选项,区别为 -sC 选项为直接输入字符串。 syscap_tool -sC "pcidstring" "rpcidstring" # 将字符串格式的 pcid 转为 json 格式,文件名 pcid.json。 -- Gitee