diff --git a/BUILD.gn b/BUILD.gn index f9d2aeef7165c47aa6df03c039bededf7cd9bac2..6d7e3d293561eeea8d157322b89c616616a19c35 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 005c7bce6a39441ada137539df5bb8906c01de7f..4ca90a9a3153cf4004c83ba3908b9ef4732a539b 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 b39cfbc8b202182f3713a5091f25d9dae741cef1..a12c3560954ca7c3a4b17610e01b9ff6583a12fb 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/ +# 将 pcid.sc 编码为JSON格式,文件名rpcid.json +syscap_tool -Rdi pcid.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/ +# 将 pcid.sc 编码为字符串格式,文件名rpcid.txt +syscap_tool -Resi pcid.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 选项为直接输入字符串。 +# 功能类似 -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 7a8e370c74822640e38b7e20459e2ac40f075784..2bc6e3eeac9123197fd7362cec87e5e3da5f22fe 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 f2f8738f4af0916b68a692241f3ef172c073c8dd..e7e32bb46490b2f7db3774674fbd13afea505428 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 d08ff36f5f0f1364760394dcffc74320c39510e8..5176caf99e98e4362b36cebbc100caf1aa857e3f 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); @@ -522,7 +522,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); @@ -743,7 +743,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"); @@ -814,7 +814,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 388dc1df971b1f74cfadb8eec641b6970ce1c0e3..44fd9922da0bff0fecab206f795d4ef2dbf6ed91 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 cc6051c2aab922c9f22004f6012f87438c6cf1dc..e7b1314d143f6dc2bb476e1686177e4599bd6f90 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) {