Debian Codegraph @

doc/reveng/anytone/d878uv/cpsfileformat.md

raw
1 # AnyTone CPS codeplug file format
2
3 The fileformat used by the CPS to store the codeplug in binary format is unfortunately not directly related to the binary representation of the codeplug written to the device (in contrast to the fileformat for the GD77, RD5R and MD-UV390). This document tries to collect my knowledge about this file format.
4
5
6 ## General layout
7 The geneal layout of the file consists of a header followed by the sequence of elements (usually lists) that form the codeplug. Each list starts with the number of elements in this list. At the end, a footer is added to the file. The order of the elements in the file is important. Due to the variable size of each element, the file-offsets differ from codeplug to codeplug.
8
9 The order of elements in the file is
10
11 * Header (fixed size)
12 * Channel list
13 * Radio ID list
14 * Zone list
15 * List of scan lists
16 * List of analog contacts
17
18 The format of each element is documented below.
19
20
21 ## Header
22 ```
23 0 8 16
24 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
25 00 | CPS version | Content size | Model name |
26 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
27 10 | 0 0 0 | HW version | |
28 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
29 20 | |
30 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
31 30 | |
32 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
33 40 | |
34 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
35 50 | |
36 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
37 60 | |
38 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
39 70 | |
40 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
41 80 | |
42 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
43 90 | |
44 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
45 a0 | |
46 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
47 b0 | |
48 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
49 c0 | |
50 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
51 d0 | |
52 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
53 e0 | |
54 +---+---+
55 ```
56
57 | Field | Description |
58 |---|---|
59 | CPS Version | Version number of the CPS as a string E.g., "V1287" |
60 | Content size | Content size in bytes, little-endian. |
61 | Model name | Model name as a string. E.g., "D878UV" |
62 | HW Version | Hardware version as a string. E.g., "V100" |
63
64
65 ## Channel list
66 The channel list consists of a simple list of all channels concatenated together preceded by the number of channels encoded as little endian.
67
68 ```
69 +---+---+---+---+---+---+ ... +
70 | #Chan | Channel data ... |
71 +---+---+---+---+---+---+ ... +
72 ```
73
74 ### Channel encoding
75 Each channel is encoded in a variable size binary blob as
76
77 ```
78 0 8 16
79 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
80 00 | ChIdx | RX frequency |RPT| TX offset |TYP|PWR|BWD| 0 |RXO|
81 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
82 10 |CAC|TKA| RXCTC | | TXCTC | |
83 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
84 20 |ADM| |CLC| |TSL|IGS| |WAL| |
85 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
86 +---+---+---+---+---+---+...+---+
87 30 | Channel name N chars ... 0 |
88 +---+---+---+---+---+---+...+---+
89 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
90 | 0 |RNG| ? | 0 0 |APT| 0 |FreqCor| 0 |SMC|ExR| 0 0 0 0 |
91 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
92 | 0 |DAK| 0 0 |
93 +---+---+---+---+
94
95 ```
96
97 | Field | Description |
98 |---|---|
99 | ChIdx | Specifies the channel index in little endian, 0-based. |
100 | RX frequency | RX frequency in 10Hz, little endian. |
101 | RPT | Repeater type, 0=simplex, 1=positive, 2=negative |
102 | TX offset | TX offset frequency in 10Hz, little endian. Sign determined by RPT field. |
103 | TPY | Channel type, 1=digital, 0=analog, ... |
104 | PWR | Power setting 0=low, 1=mid, 2=high, 3=turbo. |
105 | BWD | Analog band width 0=12.5kHz, 1=25kHz. |
106 | RXO | RX only flag. |
107 | CAC | Call confirm flag. |
108 | TKA | Talkaround flag. |
109 | RXCTC | RX CTCSS/DSC settings. |
110 | TXCTC | RX CTCSS/DSC settings. |
111 | ADM | Admit criterion, 0=always, 1=, 2=, 3=same color code. Also busy lock 1=repeater, 2=busy.|
112 | COC | Color code. |
113 | TSL | Time slot, 0=TS1, 1=TS2 |
114 | IGS | Ignore time slot flag. |
115 | WAL | Work alone flag. |
116 | Channel name | Channel name of max 16 ASCII chars. Variable size (max. 16b?). Zero padded. |
117 | RNG | Ranging flag. |
118 | APT | APRS report type, 0=none, 1=analog, 2=digital. |
119 | FreqCor | Frequency correction in Hz, little endian. |
120 | SMC | SMS confirmation flag. |
121 | ExR | Exclude from roaming flag. |
122 | DAK | Data ACK flag. |
123
124
125 ## RadioID list
126 As usual, the radio ID list starts with the number of defined IDs (little endian) and is followed by the actual list of IDs.
127 ```
128 +---+---+---+---+---+ ... +
129 |#ID| RadioID data ... |
130 +---+---+---+---+---+ ... +
131 ```
132
133 ### Radio ID encoding
134 ```
135 +---+---+---+---+---+---+ ... +---+
136 |IDX| DMR ID | Name 0 |
137 +---+---+---+---+---+---+ ... +---+
138 ```
139
140 | Field | Description |
141 |---|---|
142 | IDX | Specifies the radio ID index in little endian, 0-based. |
143 | DMR ID | The DMR ID as a 24bit little endian integer. |
144 | Name | Variable length radio ID name. ASCII, 0-terminated. |
145
146
147 ## Zone List
148 As usual, the zone starts with the number of defined zones and is followed by the actual list of zones.
149 ```
150 +---+---+---+---+ ... +
151 |#ZO| Zone data ... |
152 +---+---+---+---+ ... +
153 ```
154
155 ### Zone encoding
156 ```
157 +---+---+---+---+---+---+ ... +---+---+---+---+---+---+---+ ... +---+
158 |ZIX|NCH| Ch00 | Ch01 | ... | Chn A | Chn B | Zone name ... 0 |
159 +---+---+---+---+---+---+ ... +---+---+---+---+---+---+---+ ... +---+
160 ```
161
162 | Field | Description |
163 |---|---|
164 | ZIX | Zone index. |
165 | NCH | Number of channel in zone. |
166 | ChXX | List of 16bit, little endian, 0-based channel indices |
167 | Chn A | Zone channel A |
168 | Chn B | Zone channel B |
169 | Zone name | Name of the zone, ASCII 0-terminated. |
170
171
172 ## Scan lists
173 As usual, the scan lists starts with the number of scan lists and is followed by the actual scan lists.
174 ```
175 +---+---+---+---+---+ ... +
176 |#SL| Scan list data ... |
177 +---+---+---+---+---+ ... +
178 ```
179
180 ### Scan list encoding
181 ```
182 +---+---+---+ ... +---+---+---+---+---+---+---+---+---+---+---+---+
183 |SLI| Name ... 0 | 0 |PCS| PC1 | PC2 |RVC|LBA|LBB|DOD|DWT|
184 +---+---+---+ ... +---+---+---+---+---+---+---+---+---+---+---+---+
185 +---+---+---+---+---+---+---+ ... +
186 |NCH| 0 0 | Ch00 | Ch01 | ... |
187 +---+---+---+---+---+---+---+ ... +
188 ```
189
190 | Field | Description |
191 |---|---|
192 | SLI | Scan list index. |
193 | Name | Name of the scan list, max 16 x ASCII, 0-terminated. |
194 | PCS | Priority channel select, 0=Off, 1=PC1, 2=PC2, 3=Both |
195 | PC1 | Priority channel 1, 0=Off, 1=Current, else channel index + 2, little endian. |
196 | PC2 | Priority channel 2, 0=Off, 1=Current, else channel index + 2, little endian. |
197 | RVC | Revert channel, 0=Selected, 1=Selected+Talkback, 2=Last called, 3=Last used. |
198 | LBA | Look back time A in 100ms. |
199 | LBB | Look back time B in 100ms. |
200 | DOD | Dropout delay in 100ms. |
201 | DWT | Dwell time in 100ms. |
202 | NCH | Number of channels in scan list. |
203
204
205 ## Analog contacts
206 As usual, the analog contact list starts with the number of contacts and is followed by the actual contact list.
207 ```
208 +---+---+---+---+---+---+ ... +
209 |#AC| Analog contact data ... |
210 +---+---+---+---+---+---+ ... +
211 ```
212
213 ### Analog contact encoding
214 ```
215 +---+---+---+---+ ... +---+---+ ... +---+
216 |IDX|NoL| Number ... | Name ... 0 |
217 +---+---+---+---+ ... +---+---+ ... +---+
218 ```
219 | Field | Description |
220 |---|---|
221 | IDX | Analog contact index. |
222 | NoL | Number length. |
223 | Name | Name of the contact, max 16 x ASCII, 0-terminated. |
224