1# System Capability Encoder and Decoder Tools 2 3SysCap(SystemCapability) encoder and decoder tools common usage scenarios as follow: 4 5APP 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. 6 7Main function: 8 91. PCID Encode: Encode SysCap list to PCID. 10 112. PCID Decode: Decode PCID to get system SysCap list. 12 133. RPCID Encode: Encode APP required SysCap list to RPCID. 14 154. RPCID Decode: Decode RPCID to get APP required SysCap list. 16 17## File Structure 18 19``` 20/developtools 21├── syscap_codec # root directory 22│ ├── include 23│ │ └── syscap_tool.h # interfaces 24│ └── src 25│ │ ├── endian_internel.h # internal big/little endian conversion headers(common for win、mac、linux) 26│ │ ├── endian_internel.c # big/little endian conversion implement 27│ │ ├── main.c # command line implement 28│ │ └── syscap_tool.c # codec implement 29│ └── test 30│ | └── syscap_tool_test.c # syscap_tool test codec implement 31| |—— tools 32| │ │ 33| │ └── syscap_check.py # syscap一致性检查脚本 34``` 35 36### API 37 38PC tools, no API provided. 39 40### Building Manually 41 42syscap_tool binary building steps as follow: 43 441. Build commands:SysCap tools binary building and installation will be tiggered by SDK compiling procedure. How to build SDK please refer to https://gitee.com/openharmony/build/blob/master/README_zh.md. 45 462. Building cmd should be adjust for host platform as same as SDK compiling, the archive will in corresponding platform directoty. 47 48Note: Ubuntu host only avaiable for windows/linux building, MacOs binary should building on MacOs host. 49 50### Downloading Binary 51 521. Downlaod SDK(recommonded) 53 54Download daily builds(http://ci.openharmony.cn/dailybuilds) which included SDK. 55 562. Supported Host 57 58Windows x86_64/Linux x86_64/Darwin x86_64 59 60### Help 61 62SysCap tools usually integrate to IDE, APP store and bundle tools. Follow instructions for debugging manually: 63 64./syscap_tool -h or ./syscap_tool --help: 65``` 66./syscap_tool --help 67 68./syscap_tool -R/P -e/d -i filepath [-o outpath] 69 70-h, --help : how to use 71 72-R, --RPCID : encode or decode RPCID 73 74-P, --PCID : encode or decode PCID 75 76-e, --encode : to encode 77 78-d, --encode : to decode 79 80-i filepath, --input filepath : input file 81 82-o outpath, --input outpath : output path 83``` 84 85## Syscap consistency check tool 86 87### Functions and dependencies 88 89The tool provides the following functions: 90 911. Collect syscap fields of all components (or specified components), compare them with arraySyscap in developtools/ syscap_codec/include/syscap_define.h, and output the check results. If they are inconsistent, output the cause of the discrepancy. 922. Collect the syscap fields of all components and compare them with the @syscap property set in *.d.ts in the Interface/sdk-js/api directory. If the check results are inconsistent, output the cause of the inconsistency. 933. Compare syscap attributes in *.d.ts in all interface/ sdK-JS/API directories with arraySyscap in developtools/syscap_codec/include/syscap_define.h. If they are inconsistent, output the cause of the inconsistency. 94 95### How to use it 96 97This tool is written in Python language and needs to be executed using the Python interpreter. 98 99requirements: 100 101```txt 102prettytable==3.3.0 103``` 104 105usage: 106 107```shell 108# check syscap field in all components for consistency with arraySyscap in syscap_define.h 109python3 syscap_check.py -p path_of_openarmony -t component_codec 110 111# check that the SYSCAP field in bundle.json of the specified part is consistent with arraySyscap in syscap_define.h. Note: --bundles is valid only if --check_target is component_codec 112python3 syscap_check.py -p path_of_openarmony -t component_codec -b path_of_component1/bundle.json path_of_component2/bundle.json 113 114# check the consistency of the syscap field of all components with the "@syscap" property set in *.d.ts 115python3 syscap_check.py -p path_of_openarmony -t component_sdk 116 117# check the "@syscap" attribute set in *.d.ts for consistency with arraSyscap in syscap_define.h 118python3 syscap_check.py -p path_of_openarmony -t sdk_codec 119``` 120 121### Release Note 122 123v1.0.0 2022-3-8 first release, SysCap codec supported for Windows/Linux/Mac host. 124