README.md
1This directory contains code and tools for generating and debugging binary
2satellite s2 file.
3
4Directory structure
5=
6
7`s2storage`
8- `src/write` S2 write code used by tools to write the s2 cells into a
9 binary file. This code is also used by `TeleServiceTests`.
10- `src/readonly` S2 read-only code used by the above read-write code and the class
11 `S2RangeSatelliteOnDeviceAccessController`.
12
13`tools`
14- `src/main` Contains the tools for generating binary satellite s2 file, and tools
15 for dumping the binary file into human-readable format.
16- `src/test` Contains the test code for the tools.
17
18`configdatagenerator`
19- `src/main` Contains the tool for generating satellite configdata protobuf file.
20- `src/test` Contains the test code for the configdatagenerator tool.
21
22Run unit tests
23=
24- Build the tools and test code: Go to the tool directory (`packages/services/Telephony/tools/
25 satellite`) in the local workspace and run `mm`, e.g.,
26- Run unit tests: `$atest SatelliteToolsTests`, `$atest SatelliteGenerateProtoTests`
27
28Data file generate tools
29=
30
31`satellite_createsats2file`
32- Runs the `satellite_createsats2file` to create a binary satellite S2 file from a
33 list of S2 cells ID.
34- Command: `$satellite_createsats2file --input-file <s2cells.txt> --s2-level <12>
35 --is-allowed-list <true> --output-file <sats2.dat>`
36 - `--input-file` Each line in the file contains a `unsigned-64bit` number which represents
37 the ID of a S2 cell.
38 - `--s2-level` The S2 level of all the cells in the input file.
39 - `--is-allowed-list` Should be either `trrue` or `false`
40 - `true` The input file contains a list of S2 cells where satellite services are allowed.
41 - `false` The input file contains a list of S2 cells where satellite services are disallowed.
42 - `--output-file` The created binary satellite S2 file, which will be used by
43 the `SatelliteAccessController` module in determining if satellite communication
44 is allowed at a location.
45- Build the tools: Go to the tool directory (`packages/services/Telephony/tools/satellite`)
46 in the local workspace and run `mm`.
47- Example run command: `$satellite_createsats2file --input-file s2cells.txt --s2-level 12
48 --is-allowed-list true --output-file sats2.dat`
49
50`satellite_generateprotobuf`
51- Runs the `satellite_generateprotobuf` to create a binary file of TelephonyConfigProto whose format
52 is defined in telephony_config_update.proto
53- Command: `satellite_generateprotobuf --input-file <input.xml> --output-file <telephony_config.pb>`
54 - `--input-file` input XML file contains input information such as carrier id, carrier plmn,
55 allowed service list and country code list. This is example of input file.
56 ```xml
57 <satelliteconfig>
58 <!-- version -->
59 <version>14</version>
60
61 <!-- CarrierSupportedSatelliteServicesProto -->
62 <carriersupportedservices>
63 <carrier_id>1</carrier_id>
64 <providercapability>
65 <carrier_plmn>310160</carrier_plmn>
66 <service>1</service>
67 </providercapability>
68 <providercapability>
69 <carrier_plmn>310240</carrier_plmn>
70 <service>6</service>
71 </providercapability>
72 </carriersupportedservices>
73
74 <carriersupportedservices>
75 <carrier_id>1891</carrier_id>
76 <providercapability>
77 <carrier_plmn>45005</carrier_plmn>
78 <service>1</service>
79 <service>2</service>
80 </providercapability>
81 </carriersupportedservices>
82
83 <!-- SatelliteRegionProto -->
84 <satelliteregion>
85 <s2_cell_file>sats2.dat</s2_cell_file>
86 <country_code>US</country_code>
87 <country_code>KR</country_code>
88 <is_allowed>TRUE</is_allowed>
89 </satelliteregion>
90 </satelliteconfig>
91 ```
92 - `--output-file` The created binary TelephonyConfigProto file, which will be used by
93 the `ConfigUpdater` module for Satellite Project.
94- Build the tools: Go to the tool directory (`packages/services/Telephony/tools/satellite`)
95 in the local workspace and run `mm`.
96- Example run command: `satellite_generateprotobuf --input-file input.xml --output-file
97 telephony_config.pb`
98
99Debug tools
100=
101
102`satellite_createsats2file_test`
103- Create a test binary satellite S2 file with the following ranges:
104 - [(prefix=0b100_11111111, suffix=1000), (prefix=0b100_11111111, suffix=2000))
105 - [(prefix=0b100_11111111, suffix=2000), (prefix=0b100_11111111, suffix=3000))
106 - [(prefix=0b101_11111111, suffix=1000), (prefix=0b101_11111111, suffix=2000))
107- Run the test tool: `satellite_createsats2file_test /tmp/foo.dat`
108 - This command will generate the binary satellite S2 cell file `/tmp/foo.dat` with
109 the above S2 ranges.
110
111`satellite_dumpsats2file`
112- Dump the input binary satellite S2 cell file into human-readable text format.
113- Run the tool: `$satellite_dumpsats2file /tmp/foo.dat /tmp/foo`
114 - `/tmp/foo.dat` Input binary satellite S2 cell file.
115 - `/tmp/foo` Output directory which contains the output text files.
116
117`satellite_location_lookup`
118- Check if a location is present in the input satellite S2 file.
119- Run the tool: `$satellite_location_lookup --input-file <...> --lat-degrees <...>
120 --lng-degrees <...>`
121