1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425
|
#ifndef DR1801UVCODEPLUG_HH
#define DR1801UVCODEPLUG_HH
#include "channel.hh"
#include "codeplug.hh"
#include "contact.hh"
class Zone;
/** Implements the binary codeplug representation of a BTECH DR-1801UV (a.k.a, BF-1801-A6).
*
* This device is kind of a re-release of the BTECH DM-1801. However, the hardware and firmware
* is completely different. It is just the chassis that remained the same. This version uses the
* Auctus A6 radio-on-a-chip as its main component.
*
* @section dr1801ver Matching firmware versions
* This class implements the codeplug for the firmware version @c 1.10. The codeplug format usually
* does not change much with firmware revisions, in particular not with older radios.
*
* @section dr1801cpl Codeplug structure within radio
* The memory representation of the codeplug within the radio is simply a single large block of
* data, read and written entirely. The total size of the codeplug is 01dd90h bytes.
*
* <table>
* <tr><th>Start</th> <th>End</th> <th>Size</th> <th>Content</th></tr>
* <tr><td>0x00000</td> <td>0x00300</td> <td>0x00300</td> <td>Some unknown settings, not
* configurable through the CPS. Likely some sort of calibration data. Must be conserved.</td></tr>
* <tr><td>0x00300</td> <td>0x003bc</td> <td>0x000bc</td> <td>Some information about the radio.
* Like serial number, firmware version, etc and timestamp. </td></tr>
* <tr><td>0x003b4</td> <td>0x00418</td> <td>0x00064</td> <td>General settings, see
* @c DR1801UVCodeplug::SettingsElement. </td></tr>
* <tr><td>0x00418</td> <td>0x04110</td> <td>0x00000</td> <td>Zone bank, see
* @c DR1801UVCodeplug::ZoneBankElement. </td></tr>
* <tr><td>0x04110</td> <td>0x04274</td> <td>0x00164</td> <td>Message bank, see
* @c DR1801UVCodeplug::MessageBankElement. </td></tr>
* <tr><td>0x04334</td> <td>0x0a338</td> <td>0x06008</td> <td>Contact bank, see
* @c DR1801UVCodeplug::ContactBankElement. </td></tr>
* <tr><td>0x0a338</td> <td>0x0a65c</td> <td>0x00324</td> <td>Scan-list bank, see
* @c DR1801UVCodeplug::ScanListBankElement. </td></tr>
* <tr><td>0x0a65c</td> <td>0x1c660</td> <td>0x12004</td> <td>Channel bank, see
* @c DR1801UVCodeplug::ChannelBankElement. </td></tr>
* <tr><td>0x1c6c4</td> <td>0x1c6dc</td> <td>0x0018</td> <td>Key settings, see
* @c DR1801UVCodeplug::KeySettingsElement. </td></tr>
* <tr><td>0x1c6dc</td> <td>0x1d7e0</td> <td>0x01104</td> <td>Group list bank, see
* @c DR1801UVCodeplug::GroupListBankElement. </td></tr>
* <tr><td>0x1d7e0</td> <td>0x1d858</td> <td>0x00078</td> <td>Encryption keys, see
* @c DR1801UVCodeplug::EncryptionKeyBankElement. </td></tr>
* <tr><td>0x1d858</td> <td>0x1daf4</td> <td>0x0029c</td> <td>DTMF signaling settings, see
* @c DR1801UVCodeplug::DTMFSettingsElement. </td></tr>
* <tr><td>0x1daf4</td> <td>0x1dbb8</td> <td>0x00c4</td> <td>Alarm settings, see
* @c DR1801UVCodeplug::AlarmSettingsBankElement. </tr>
* <tr><td>0x1dbb8</td> <td>0x1dbc8</td> <td>0x0010</td> <td>DMR settings, see
* @c DR1801UVCodeplug::DMRSettingsElement. </td></tr>
* <tr><td>0x1dbc8</td> <td>0x1dbf0</td> <td>0x00028</td> <td>One-touch settings, see
* @c DR1801UVCodeplug::OneTouchSettingsElement. </td></tr>
* <tr><td>0x1dbf0</td> <td>0x1dd00</td> <td>0x00110</td> <td>Some unknown settings.</td></tr>
* <tr><td>0x1dd00</td> <td>0x1dd90</td> <td>0x00090</td> <td>VFO channels, see
* @c DR1801UVCodeplug::VFOBankElement. </td></tr>
* </table>
*
* @ingroup dr1801uv */
class DR1801UVCodeplug : public Codeplug
{
Q_OBJECT
public:
/** Implements the binary encoding of the channels settings.
*
* Memory representation of the channel settings (0034h bytes):
* @verbinclude dr1801uv_channelelement.txt */
class ChannelElement: public Element
{
public:
/** Possible channel types. */
enum class Type {
FM = 1, DMR = 3
};
/** Possible power settings. */
enum class Power {
Low = 0, High = 1
};
/** Possible values for the admid criterion. */
enum class Admit {
Always = 0, ColorCode_or_Tone = 1, ChannelFree = 2
};
/** Possible time-slot values. */
enum class TimeSlot {
TS1 = 1, TS2 = 2
};
/** Possible FM signaling modes. */
enum class SignalingMode {
None = 0, DTMF = 1
};
/** Possible band width settings. */
enum class Bandwidth {
Narrow = 1, Wide = 2
};
/** Possible subtone types. */
enum class SubToneType {
None = 0, CTCSS = 1, DCS = 2
};
/** Possible DCS modes. */
enum class DCSMode {
Normal = 0, Inverted = 1
};
protected:
/** Hidden constructor. */
ChannelElement(uint8_t *ptr, size_t size);
public:
/** Constructor from pointer. */
ChannelElement(uint8_t *ptr);
bool isValid() const;
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x00034; }
/** Returns the 0-based index of the channel. */
virtual unsigned int index() const;
/** Sets the index. */
virtual void setIndex(unsigned int idx);
/** Returns the channel type. */
virtual Type channelType() const;
/** Sets the channel type. */
virtual void setChannelType(Type type);
/** Returns the power settings of the channel. */
virtual Channel::Power power() const;
/** Sets the power for the channel. */
virtual void setPower(Channel::Power pwr);
/** Returns the RX frequency in MHz. */
virtual Frequency rxFrequency() const;
/** Sets the RX frequency in MHz. */
virtual void setRXFrequency(Frequency MHz);
/** Returns the TX frequency in MHz. */
virtual Frequency txFrequency() const;
/** Sets the TX frequency in MHz. */
virtual void setTXFrequency(Frequency MHz);
/** Returns @c true if a contact index is set. */
virtual bool hasTransmitContact() const;
/** Returns the contact index. */
virtual unsigned int transmitContactIndex() const;
/** Sets the transmit contact index. */
virtual void setTransmitContactIndex(unsigned int index);
/** Clears the contact index. */
virtual void clearTransmitContactIndex();
/** Returns the admit criterion. */
virtual Admit admitCriterion() const;
/** Sets the admit criterion. */
virtual void setAdmitCriterion(Admit admit);
/** Returns the color code (0-15). */
virtual unsigned int colorCode() const;
/** Sets the color code (0-15). */
virtual void setColorCode(unsigned int cc);
/** Returns the time slot. */
virtual DMRChannel::TimeSlot timeSlot() const;
/** Sets the time slot. */
virtual void setTimeSlot(DMRChannel::TimeSlot ts);
/** Returns @c true if an ecryption key index is set. */
virtual bool hasEncryptionKey() const;
/** Returns the encryption key index. */
virtual unsigned int encryptionKeyIndex() const;
/** Sets the encryption key index. */
virtual void setEncryptionKeyIndex(unsigned int index);
/** Clears the encryption key index. */
virtual void clearEncryptionKeyIndex();
/** Returns @c true if dual-capacity direct mode is enabled. */
virtual bool dcdm() const;
/** Enables/disables dual-capacity direct mode. */
virtual void enableDCDM(bool enable);
/** Returns @c true if private-call confirmation is enabled. */
virtual bool confirmPrivateCall() const;
/** Enables/disables private-call confirmation. */
virtual void enablePrivateCallConfirmation(bool enable);
/** Returns the FM signaling mode. */
virtual SignalingMode signalingMode() const;
/** Sets the FM signaling mode. */
virtual void setSignalingMode(SignalingMode mode);
/** Returns @c true if the alarm system index is set. */
virtual bool hasAlarmSystem() const;
/** Returns the index of the alarm system. */
virtual unsigned int alarmSystemIndex() const;
/** Sets the alarm system index. */
virtual void setAlarmSystemIndex(unsigned int index);
/** Clears the alarm system index. */
virtual void clearAlarmSystemIndex();
/** Returns the band width for FM channels. */
virtual FMChannel::Bandwidth bandwidth() const;
/** Sets the band width for FM channels. */
virtual void setBandwidth(FMChannel::Bandwidth bw);
/** Returns @c true, if the auto-scan is enabled. */
virtual bool autoScanEnabled() const;
/** Enables/disables auto-scan. */
virtual void enableAutoScan(bool enable);
/** Returns @c true if a scan list is assigned. */
virtual bool hasScanList() const;
/** Returns the scan list index. */
virtual unsigned int scanListIndex() const;
/** Sets the scan list index. */
virtual void setScanListIndex(unsigned int index);
/** Clears the scan list index. */
virtual void clearScanListIndex();
/** Returns the RX CTCSS/DCS signaling. */
virtual SelectiveCall rxTone() const;
/** Sets the RX CTCSS/DCS signaling. */
virtual void setRXTone(const SelectiveCall &code);
/** Returns the TX CTCSS/DCS signaling. */
virtual SelectiveCall txTone() const;
/** Sets the TX CTCSS/DCS signaling. */
virtual void setTXTone(const SelectiveCall &code);
/** Returns @c true if talkaround is enabled. */
virtual bool talkaround() const;
/** Enables/disables talkaround. */
virtual void enableTalkaround(bool enable);
/** Returns @c true if a PTT ID is set. */
virtual bool hasPTTID() const;
/** Returns the PTT-ID index. */
virtual unsigned int pttIDIndex() const;
/** Sets the PTT-ID index. */
virtual void setPTTIDIndex(unsigned int idx);
/** Clears the PTT ID. */
virtual void clearPTTID();
/** Returns @c true if a group list is assigned. */
virtual bool hasGroupList() const;
/** Returns the group-list index. */
virtual unsigned int groupListIndex() const;
/** Sets the group-list index. */
virtual void setGroupListIndex(unsigned int index);
/** Clears the group list index. */
virtual void clearGroupListIndex();
/** Returns @c true if lone-worker is enabled. */
virtual bool loneWorker() const;
/** Enables/disables lone-worker. */
virtual void enableLoneWorker(bool enable);
/** Constructs a channel object. */
virtual Channel *toChannelObj(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links the channel object. */
virtual bool linkChannelObj(Channel *channel, Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes the given channel. */
virtual bool encode(Channel *channel, Context &ctx, const ErrorStack &err=ErrorStack());
protected:
/** Some offsets within the codeplug. */
struct Offset: Element::Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int index() { return 0x0000; }
static constexpr unsigned int channelType() { return 0x0002; }
static constexpr unsigned int power() { return 0x0003; }
static constexpr unsigned int rxFrequency() { return 0x0004; }
static constexpr unsigned int txFrequency() { return 0x0008; }
static constexpr unsigned int transmitContactIndex() { return 0x000c; }
static constexpr unsigned int admitCriterion() { return 0x000e; }
static constexpr unsigned int colorCode() { return 0x0010; }
static constexpr unsigned int timeSlot() { return 0x0011; }
static constexpr unsigned int encryptionKeyIndex() { return 0x0014; }
static constexpr Bit dcdm() { return {0x0015, 1} ; }
static constexpr Bit confirmPivateCall() { return {0x0015, 0}; }
static constexpr unsigned int signalingMode() { return 0x0016; }
static constexpr unsigned int alarmSystemIndex() { return 0x0018; }
static constexpr unsigned int bandwidth() { return 0x0019; }
static constexpr unsigned int autoScan() { return 0x001a; }
static constexpr unsigned int scanListIndex() { return 0x001b; }
static constexpr unsigned int rxSubtoneCode() { return 0x001c; }
static constexpr unsigned int rxSubtoneType() { return 0x001e; }
static constexpr unsigned int rxDCSMode() { return 0x001f; }
static constexpr unsigned int txSubtoneCode() { return 0x0020; }
static constexpr unsigned int txSubtoneType() { return 0x0022; }
static constexpr unsigned int txDCSMode() { return 0x0023; }
static constexpr unsigned int talkaround() { return 0x0025; }
static constexpr unsigned int pttIDIndex() { return 0x0028; }
static constexpr unsigned int groupListIndex() { return 0x002a; }
static constexpr unsigned int loneWorker() { return 0x002f; }
/// @endcond
};
};
/** Implements the binary encoding of the channel bank.
*
* Holds up to 1024 @c DR1801UVCodeplug::ChannelElement.
*
* Memory representation of the channel bank (12004h bytes):
* @verbinclude dr1801uv_channelbankelement.txt */
class ChannelBankElement: public Element
{
protected:
/** Hidden constructor. */
ChannelBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ChannelBankElement(uint8_t *ptr);
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x12004; }
/** Returns the number of channels. */
virtual unsigned int channelCount() const;
/** Sets the number of channels. */
virtual void setChannelCount(unsigned int count);
/** Returns a reference to the channel element that the given index. */
virtual ChannelElement channel(unsigned int index) const;
/** Returns the name of the channel at the given index. */
virtual QString channelName(unsigned int index) const;
/** Sets the name of the channel at the given index. */
virtual void setChannelName(unsigned int index, const QString &name);
/** Decodes all defined channels. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links channels. */
virtual bool link(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all channels. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Limits of some elements. */
struct Limit {
/** Returns the maximum number of channels. */
static constexpr unsigned int channelCount() { return 1024; }
/** Returns the maximum length of a channel name. */
static constexpr unsigned int channelNameLength() { return 0x00014; }
};
protected:
/** Offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int channelCount() { return 0x00000; }
static constexpr unsigned int channel() { return 0x00004; }
static constexpr unsigned int channelName() { return 0x0d004; }
/// @endcond
};
};
/** Implements the binary encoding of a contact.
*
* Memory representation of contact (0018h bytes):
* @verbinclude dr1801uv_contactelement.txt */
class ContactElement: public Element
{
public:
/** Possible call types. */
enum class CallType {
AllCall = 0x20, PrivateCall = 0x40, GroupCall = 0x80
};
protected:
/** Hidden constructor. */
ContactElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ContactElement(uint8_t *ptr);
bool isValid() const;
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x00018; }
/** Returns @c true if the contact has a successor. */
virtual bool hasSuccessor() const;
/** Returns the index of the next element. */
virtual uint16_t successorIndex() const;
/** Sets successor index. */
virtual void setSuccessorIndex(uint16_t index);
/** Clears the successor index. */
virtual void clearSuccessorIndex();
/** Returns the number. */
virtual uint32_t dmrID() const;
/** Sets the number. */
virtual void setDMRID(uint32_t id);
/** Returns the call type. */
virtual DMRContact::Type type() const;
/** Sets the call type. */
virtual void setCallType(DMRContact::Type type);
/** Returns the name of the contact. */
virtual QString name() const;
/** Sets the name of the contact. */
virtual void setName(const QString &name);
/** Constructs a DMR contact object from this contact elmeent. */
virtual DMRContact *toContactObj(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links the DMR contact object. */
virtual bool linkContactObj(DMRContact *contact, Context &ctx, const ErrorStack &err=ErrorStack());
/** Encodes the contact. */
virtual bool encode(DMRContact *contact, Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits. */
struct Limit {
/** Maximum length of the contact name. */
static constexpr unsigned int nameLength() { return 16; }
};
protected:
/** Defines offsets within the element. */
struct Offset : public Element::Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int successorIndex() { return 0x0000; }
static constexpr unsigned int nameLength() { return 0x0002; }
static constexpr unsigned int dmrID() { return 0x0004; }
static constexpr unsigned int callType() { return 0x0007; }
static constexpr unsigned int name() { return 0x0008; }
/// @endcond
};
};
/** Implements the binary encoding of the contact bank.
*
* The bank holds the list of all contacts defined. See @c DR1801UVCodeplug::ContactElement for
* details.
*
* Memory representation of the contact bank (6008h bytes):
* @verbinclude dr1801uv_contactbankelement.txt */
class ContactBankElement: public Element
{
protected:
/** Hidden constructor. */
ContactBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ContactBankElement(uint8_t *ptr);
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x06004; }
/** Returns the number of contacts. */
virtual unsigned int contactCount() const;
/** Sets the number of contacts. */
virtual void setContactCount(unsigned int count);
/** Returns the index of the first contact. */
virtual unsigned int firstIndex() const;
/** Sets the index of the first element. */
virtual void setFirstIndex(unsigned int index);
/** Returns a reference to the n-th contact. */
virtual ContactElement contact(unsigned int index) const;
/** Decodes all contacts and stores them into the given context and config. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links all contacts. */
virtual bool link(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all contacts. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some Limits.*/
struct Limit {
/** The maximum number of contacts. */
static constexpr unsigned int contactCount() { return 1024; }
};
protected:
/** Offsets within the element. */
struct Offset : public Element::Offset{
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int contactCount() { return 0x0000; }
static constexpr unsigned int firstIndex() { return 0x0002; }
static constexpr unsigned int contacts() { return 0x0004; }
/// @endcond
};
};
/** Implements the binary encoding of a group list.
*
* Memory representation of group list (44h bytes):
* @verbinclude dr1801uv_grouplistelement.txt */
class GroupListElement: public Element
{
protected:
/** Hidden constructor. */
GroupListElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
GroupListElement(uint8_t *ptr);
bool isValid() const;
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00044; }
/** Returns the index of the group list. */
virtual unsigned int index() const;
/** Sets the index of the group list. */
virtual void setIndex(unsigned int index);
/** Returns the number of elements in the list. */
virtual unsigned int count() const;
/** Sets the number of elements in the list. */
virtual void setCount(unsigned int n);
/** Returns @c true if the n-th member index is set. */
virtual bool hasMemberIndex(unsigned int n) const;
/** Returns the n-th member index. */
virtual unsigned int memberIndex(unsigned int n) const;
/** Sets the n-th member index. */
virtual void setMemberIndex(unsigned int n, unsigned int index);
/** Clears the n-th member index. */
virtual void clearMemberIndex(unsigned int n);
/** Constructs a group list object from this elmeent. */
virtual RXGroupList *toGroupListObj(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links the group list object. */
virtual bool linkGroupListObj(RXGroupList *list, Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links the group list object. */
virtual bool encode(RXGroupList *list, Context &ctx, const ErrorStack &err=ErrorStack());
protected:
/** Some offset within the codeplug. */
struct Offset: public Element::Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int count() { return 0x0000; }
static constexpr unsigned int index() { return 0x0002; }
static constexpr unsigned int members() { return 0x0004; }
/// @endcond
};
/** Some limits. */
struct Limit {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int members() { return 10; }
/// @endcond
};
};
/** Implements the binary encoding of the group-list bank.
*
* Memory representation of the group-list bank (??h bytes):
* @verbinclude dr1801uv_grouplistbankelement.txt */
class GroupListBankElement: public Element
{
protected:
/** Hidden constructor. */
GroupListBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
GroupListBankElement(uint8_t *ptr);
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x01104; }
/** Returns the number of group lists defined. */
virtual unsigned int groupListCount() const;
/** Sets the number of group lists. */
virtual void setGroupListCount(unsigned int count);
/** Returns a reference to the group list at the given index. */
virtual GroupListElement groupList(unsigned int index) const;
/** Decodes all group lists. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links all group lists. */
virtual bool link(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all group lists. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits. */
struct Limit {
/** The maximum number of group lists. */
static constexpr unsigned int groupListCount() { return 64; }
};
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int groupListCount() { return 0x0000; }
static constexpr unsigned int groupLists() { return 0x00004; }
/// @endcond
};
};
/** Implements the binary encoding of a zone.
*
* Memory representation of zone (68h bytes):
* @verbinclude dr1801uv_zoneelement.txt */
class ZoneElement: public Element
{
protected:
/** Hidden constructor. */
ZoneElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ZoneElement(uint8_t *ptr);
bool isValid() const;
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00068; }
/** Returns the name of the zone. */
virtual QString name() const;
/** Sets the name of the zone. */
virtual void setName(const QString &name);
/** Returns the number of entries. */
virtual unsigned int numEntries() const;
/** Returns the channel index of the n-th entry. */
virtual unsigned int entryIndex(unsigned int n);
/** Sets the n-th entry index. */
virtual void setEntryIndex(unsigned int n, unsigned int index);
/** Returns the index of the zone. */
virtual unsigned int index() const;
/** Sets the index of the zone. */
virtual void setIndex(unsigned int index);
/** Constructs a zone object from this element. */
virtual Zone *toZoneObj(Context &ctx, const ErrorStack &err=ErrorStack());
/** Links the zone object. */
virtual bool linkZoneObj(Zone *obj, Context &ctx, const ErrorStack &err=ErrorStack());
/** Encodes the zone. */
virtual bool encode(Zone *obj, Context &ctx, const ErrorStack &err=ErrorStack());
/** Some limits. */
struct Limit {
/** The maximum name length. */
static constexpr unsigned int nameLength() { return 32; }
/** The maximum number of channels in the zone. */
static constexpr unsigned int memberCount() { return 32; }
};
protected:
/** Some offset within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int name() { return 0x0000; }
static constexpr unsigned int nameLength() { return 0x0020; }
static constexpr unsigned int numEntries() { return 0x0022; }
static constexpr unsigned int index() { return 0x0024; }
static constexpr unsigned int members() { return 0x0028; }
/// @endcond
};
};
/** Implements the binary encoding of the zone bank.
*
* Memory representation of the zone bank (3cf8h bytes):
* @verbinclude dr1801uv_zonebankelement.txt */
class ZoneBankElement: public Element
{
protected:
/** Hidden constructor. */
ZoneBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ZoneBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x03cf8; }
/** Returns the number of zones. */
virtual unsigned int zoneCount() const;
/** Sets the number of zones. */
virtual void setZoneCount(unsigned int count);
/** Returns the so-called up-zone index. */
virtual unsigned int upZoneIndex() const;
/** Sets the so-called up-zone index. */
virtual void setUpZoneIndex(unsigned int index);
/** Returns the so-called down-zone index. */
virtual unsigned int downZoneIndex() const;
/** Sets the so-called down-zone index. */
virtual void setDownZoneIndex(unsigned int index);
/** Returns a reference to the n-th zone. */
virtual ZoneElement zone(unsigned int index) const;
/** Decodes all zones. */
virtual bool decode(Context &ctx, const ErrorStack &err = ErrorStack()) const;
/** Links all zones. */
virtual bool link(Context &ctx, const ErrorStack &err = ErrorStack()) const;
/** Encodes all zones. */
virtual bool encode(Context &ctx, const ErrorStack &err = ErrorStack());
public:
/** Some limits. */
struct Limit {
/** The maximum number of zones. */
static constexpr unsigned int zoneCount() { return 150; }
};
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int zoneCount() { return 0x0000; }
static constexpr unsigned int upZoneIndex() { return 0x0002; }
static constexpr unsigned int downZoneIndex() { return 0x0004; }
static constexpr unsigned int zones() { return 0x0008; }
/// @endcond
};
};
/** Implements the binary encoding of the settings element.
*
* Memory representation of settings element (64h bytes):
* @verbinclude dr1801uv_settingselement.txt */
class SettingsElement: public Element
{
public:
/** Possible power-save modes. */
enum class PowerSaveMode {
Off = 0, Save50 = 1, Save25 = 2, Save12 = 3
};
/** Possible UI languages. */
enum class Language {
SimplifiedChinese = 0, English = 1
};
/** Possible squelch modes. */
enum class SquelchMode {
Normal = 0, Silent = 1
};
/** Possible ring tone variants. */
enum class RingTone {
Off = 0, RingTone1 = 1, RingTone2 = 2, RingTone3 = 3, RingTone4 = 4, RingTone5 = 5,
RingTone6 = 6, RingTone7 = 7, RingTone8 = 8, RingTone9 = 9, RingTone10 = 10, RingTone11 = 11,
RingTone12 = 12, RingTone13 = 13, RingTone14 = 14, RingTone15 = 15, RingTone16 = 16,
RingTone17 = 17, RingTone18 = 18, RingTone19 = 19, RingTone20 = 20
};
/** Possible backlight time settings. */
enum class BacklightTime {
Infinite = 0, Off = 1, On5s = 2, On10s = 3
};
/** Possible tuning modes. */
enum class TuningMode {
Channel = 0, VFO = 1
};
/** Possible display modes. */
enum class DisplayMode {
Number = 0, Name = 1, Frequency = 2
};
/** Possible dual-watch modes. */
enum class DualWatchMode {
Off = 0, DoubleDouble = 1, DoubleSingle = 2
};
/** Possible scan modes. */
enum class ScanMode {
Time = 0, Carrier = 1, Search = 2
};
/** Possible boot screen modes. */
enum class BootScreen {
Picture = 0, Text = 1
};
protected:
/** Hidden constructor. */
SettingsElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
SettingsElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00064; }
/** Returns the radios DMR ID. */
virtual unsigned int dmrID() const;
/** Sets the radios DMR ID. */
virtual void setDMRID(unsigned int id);
/** Returns the the power-save mode. */
virtual PowerSaveMode powerSaveMode() const;
/** Sets the power-save mode. */
virtual void setPowerSaveMode(PowerSaveMode mode);
/** Returns the VOX sensitivity [0,10].
* 0 means VOX off. */
virtual unsigned int voxSensitivity() const;
/** Sets the VOX sensitivity [0,10].
* 0 means VOX off. */
virtual void setVOXSensitivity(unsigned int sens);
/** Returns the VOX delay in ms. */
virtual unsigned int voxDelay() const;
/** Sets the VOX delay in ms. */
virtual void setVOXDelay(unsigned int ms);
/** Returns @c true if encryption is enabled. */
virtual bool encryptionEnabled() const;
/** Enables/disables encryption globally. */
virtual void enableEncryption(bool enable);
/** Returns @c true if the key-lock is enabled. */
virtual bool keyLockEnabled() const;
/** Enable/disable key-lock. */
virtual void enableKeyLock(bool enable);
/** Returns the key-lock delay in seconds. */
virtual unsigned int keyLockDelay() const;
/** Sets the key-lock delay in seconds. */
virtual void setKeyLockDelay(unsigned int sec);
/** Returns @c true if the side-key 1 gets locked too. */
virtual bool lockSideKey1() const;
/** Enables/disables locking the side-key 1. */
virtual void enableLockSideKey1(bool enable);
/** Returns @c true if the side-key 2 gets locked too. */
virtual bool lockSideKey2() const;
/** Enables/disables locking the side-key 2. */
virtual void enableLockSideKey2(bool enable);
/** Returns @c true if the PTT gets locked too. */
virtual bool lockPTT() const;
/** Enables/disables locking the PTT. */
virtual void enableLockPTT(bool enable);
/** Returns the UI language. */
virtual Language language() const;
/** Sets the UI language. */
virtual void setLanguage(Language lang);
/** Returns the squelch mode. */
virtual SquelchMode squelchMode() const;
/** Sets the squelch mode. */
virtual void setSquelchMode(SquelchMode mode);
/** Returns @c true, if the roger tones are enabled. */
virtual bool rogerTonesEnabled() const;
/** Enables/disables roger tones. */
virtual void enableRogerTones(bool enable);
/** Returns @c true if the DMR call out roger tone is enabled. */
virtual bool dmrCallOutToneEnabled() const;
/** Enables/disables the DMR call out roger tone. */
virtual void enableDMRCallOutTone(bool enable);
/** Returns @c true if the DMR voice end roger tone is enabled. */
virtual bool dmrVoiceEndToneEnabled() const;
/** Enables/disables the DMR voice end roger tone. */
virtual void enableDMRVoiceEndTone(bool enable);
/** Returns @c true if the DMR call end roger tone is enabled. */
virtual bool dmrCallEndToneEnabled() const;
/** Enables/disables the DMR call end roger tone. */
virtual void enableDMRCallEndTone(bool enable);
/** Returns @c true if the FM voice end roger tone is enabled. */
virtual bool fmVoiceEndToneEnabled() const;
/** Enables/disables the FM voice end roger tone. */
virtual void enableFMVoiceEndTone(bool enable);
/** Returns @c true if the FM call out roger tone is enabled. */
virtual bool fmCallOutToneEnabled() const;
/** Enables/disables the FM call out roger tone. */
virtual void enableFMCallOutTone(bool enable);
/** Returns @c true if the message tone is enabled. */
virtual bool messageToneEnabled() const;
/** Enables/disables message tone. */
virtual void enableMessageTone(bool enable);
/** Returns the ring tone. */
virtual RingTone ringTone() const;
/** Sets the ring tone. */
virtual void setRingTone(RingTone tone);
/** Returns the radio name. */
virtual QString radioName() const;
/** Sets the radio name. */
virtual void setRadioName(const QString &name);
/** Returns the reverse burst frequency in Hz. */
virtual float reverseBurstFrequency() const;
/** Sets the reverse burst frequency in Hz. */
virtual void setReverseBurstFrequency(float Hz);
/** Returns the backlight time settings. */
virtual BacklightTime backlightTime() const;
/** Sets the backlight time. */
virtual void setBacklightTime(BacklightTime time);
/** Returns @c true, if campanding is enabled. */
virtual bool campandingEnabled() const;
/** Enables/disables campanding. */
virtual void enableCampanding(bool enable);
/** Returns the tuning mode up-direction. */
virtual TuningMode tunigModeUp() const;
/** Sets the tuning mode up-direction. */
virtual void setTuningModeUp(TuningMode mode);
/** Returns the tuning mode down-direction. */
virtual TuningMode tunigModeDown() const;
/** Sets the tuning mode down-direction. */
virtual void setTuningModeDown(TuningMode mode);
/** Returns the display mode. */
virtual DisplayMode displayMode() const;
/** Sets the display mode. */
virtual void setDisplayMode(DisplayMode mode);
/** Returns the dual-watch mode. */
virtual DualWatchMode dualWatchMode() const;
/** Sets the dual-watch mode. */
virtual void setDualWatchMode(DualWatchMode mode);
/** Returns the scan mode. */
virtual ScanMode scanMode() const;
/** Sets the scan mode. */
virtual void setScanMode(ScanMode mode);
/** Returns the boot-screen mode. */
virtual BootScreen bootScreen() const;
/** Sets the boot-screen mode. */
virtual void setBootScreen(BootScreen mode);
/** Returns the boot-screen line 1. */
virtual QString bootLine1() const;
/** Sets the boot-screen line 1. */
virtual void setBootLine1(const QString &line);
/** Returns the boot-screen line 2. */
virtual QString bootLine2() const;
/** Sets the boot-screen line 2. */
virtual void setBootLine2(const QString &line);
/** Returns @c true if the LED is enabled. */
virtual bool ledEnabled() const;
/** Enables/disables the LED. */
virtual void enableLED(bool enabled);
/** Returns the lone-worker response time in seconds. */
virtual unsigned int loneWorkerResponseTime() const;
/** Sets the lone-worker response time in seconds. */
virtual void setLoneWorkerResponseTime(unsigned int sec);
/** Returns the lone-worker reminder time in seconds. */
virtual unsigned int loneWorkerReminderTime() const;
/** Sets the lone-worker resminder time in seconds. */
virtual void setLoneWorkerReminderTime(unsigned int sec);
/** Returns @c true if the boot password is enabled. */
virtual bool bootPasswordEnabled() const;
/** Returns the boot password. */
virtual QString bootPassword() const;
/** Sets and enables boot password. */
virtual void setBootPassword(const QString &passwd);
/** Clears and disables boot password. */
virtual void clearBootPassword();
/** Returns @c true if the programming password is enabled. */
virtual bool progPasswordEnabled() const;
/** Returns the programming password. */
virtual QString progPassword() const;
/** Sets and enables programming password. */
virtual void setProgPassword(const QString &passwd);
/** Clears and disables programming password. */
virtual void clearProgPassword();
/** Updates configuration. */
virtual bool updateConfig(Config *config, const ErrorStack &err=ErrorStack());
/** Encode from config. */
virtual bool fromConfig(Config *config, const ErrorStack &err=ErrorStack());
protected:
/** Some offsets within the element. */
struct Offset: Element::Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int dmrID() { return 0x0000; }
static constexpr unsigned int powerSaveEnabled() { return 0x0008; }
static constexpr unsigned int powerSaveMode() { return 0x0009; }
static constexpr unsigned int voxSensitivity() { return 0x000a; }
static constexpr unsigned int voxDelay() { return 0x000c; }
static constexpr unsigned int encryptionEnabled() { return 0x000d; }
static constexpr unsigned int keyLockDelay() { return 0x000e; }
static constexpr Bit lockPTT() { return {0x000f, 0}; }
static constexpr Bit lockSideKey1() { return {0x000f, 1}; }
static constexpr Bit lockSideKey2() { return {0x000f, 2}; }
static constexpr unsigned int language() { return 0x0010; }
static constexpr unsigned int squelchMode() { return 0x0011; }
static constexpr unsigned int rogerTonesEnabled() { return 0x0013; }
static constexpr unsigned int keyLockEnabled() { return 0x0017; }
static constexpr unsigned int ringTone() { return 0x0016; }
static constexpr unsigned int radioName() { return 0x0018; }
static constexpr Bit dmrCallOutToneEnabled() { return {0x0028, 1}; }
static constexpr Bit fmCallOutToneEnabled() { return {0x0028, 2}; }
static constexpr Bit dmrVoiceEndToneEnabled() { return {0x0028, 3}; }
static constexpr Bit fmVoiceEndToneEnabled() { return {0x0028, 4}; }
static constexpr Bit dmrCallEndToneEnabled() { return {0x0028, 5}; }
static constexpr Bit messageToneEnabled() { return {0x0028, 6}; }
static constexpr unsigned int reverseBurstFrequency() { return 0x002c; }
static constexpr unsigned int backlightTime() { return 0x002f; }
static constexpr unsigned int voxEnabled() { return 0x0030; }
static constexpr unsigned int campandingEnabled() { return 0x0032; }
static constexpr unsigned int tuningModeUp() { return 0x0036; }
static constexpr unsigned int tunigModeDown() { return 0x0037; }
static constexpr unsigned int displayMode() { return 0x003c; }
static constexpr unsigned int dualWatchMode() { return 0x003d; }
static constexpr unsigned int scanMode() { return 0x003e; }
static constexpr unsigned int bootScreen() { return 0x003f; }
static constexpr unsigned int bootLine1() { return 0x0040; }
static constexpr unsigned int bootLine2() { return 0x0048; }
static constexpr unsigned int ledEnabled() { return 0x0050; }
static constexpr unsigned int loneWorkerResponseTime() { return 0x0051; }
static constexpr unsigned int loneWorkerReminderTime() { return 0x005c; }
static constexpr Bit progPasswordEnabled() { return {0x0052, 0}; }
static constexpr Bit bootPasswordEnabled() { return {0x0052, 1}; }
static constexpr unsigned int progPasswordLength() { return 0x0053; }
static constexpr unsigned int progPassword() { return 0x0054; }
static constexpr unsigned int boolPasswordLength() { return 0x005d; }
static constexpr unsigned int bootPassword() { return 0x005e; }
/// @endcond
};
public:
/** Some limits. */
struct Limit {
/** Maximum radio name length. */
static constexpr unsigned int radioNameLength() { return 16; }
/** Maximum boot-text lines length. */
static constexpr unsigned int bootLineLength() { return 8; }
/** Maximum boot password length. */
static constexpr unsigned int bootPasswordLength() { return 6; }
/** Maximum programming password length. */
static constexpr unsigned int progPasswordLength() { return 6; }
};
};
/** Implements the binary encoding of a scan list element.
*
* Memory representation of a scan list element (50h bytes):
* @verbinclude dr1801uv_scanlistelement.txt */
class ScanListElement: public Element
{
public:
/** Possible priority channel modes. */
enum class PriorityChannel {
None = 0, Fixed = 1, Selected = 2
};
/** Possible revert channel modes. */
enum class RevertChannel {
LastActive = 0, Fixed = 1, Selected = 2
};
protected:
/** Hidden constructor. */
ScanListElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ScanListElement(uint8_t *ptr);
bool isValid() const;
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00050; }
/** Returns the index of the scan list. */
virtual unsigned int index() const;
/** Sets the index of the scan list. */
virtual void setIndex(unsigned int idx);
/** Returns the number of entries. */
virtual unsigned int entryCount() const;
/** Sets the number of entries. */
virtual void setEntryCount(unsigned int num);
/** Returns the priority channel 1 setting. */
virtual PriorityChannel priorityChannel1() const;
/** Sets the priority channel 1 setting. */
virtual void setPriorityChannel1(PriorityChannel mode);
/** Returns the priority channel 1 index. */
virtual unsigned int priorityChannel1Index() const;
/** Sets the priority channel 1 index. */
virtual void setPriorityChannel1Index(unsigned int index);
/** Returns the priority channel 2 setting. */
virtual PriorityChannel priorityChannel2() const;
/** Sets the priority channel 2 setting. */
virtual void setPriorityChannel2(PriorityChannel mode);
/** Returns the priority channel 2 index. */
virtual unsigned int priorityChannel2Index() const;
/** Sets the priority channel 2 index. */
virtual void setPriorityChannel2Index(unsigned int index);
/** Returns the revert channel setting. */
virtual RevertChannel revertChannel() const;
/** Sets the revert channel setting. */
virtual void setRevertChannel(RevertChannel mode);
/** Returns the revert channel index. */
virtual unsigned int revertChannelIndex() const;
/** Sets the revert channel index. */
virtual void setRevertChannelIndex(unsigned int index);
/** Returns the name of the scan list. */
virtual QString name() const;
/** Sets the name of the scan list. */
virtual void setName(const QString &name);
/** Returns the n-th entry index. */
virtual unsigned int entryIndex(unsigned int n);
/** Sets the n-th entry index. */
virtual void setEntryIndex(unsigned int n, unsigned int index);
/** Constructs a scan-list object from this element. */
virtual ScanList *toScanListObj(Context &ctx, const ErrorStack &err=ErrorStack());
/** Links the scan-list object. */
virtual bool linkScanListObj(ScanList *obj, Context &ctx, const ErrorStack &err=ErrorStack());
/** Encodes the scan list. */
virtual bool encode(ScanList *obj, Context &ctx, const ErrorStack &err=ErrorStack());
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NO_DOCUMENT
static constexpr unsigned int index() { return 0x0000; }
static constexpr unsigned int name() { return 0x0010; }
static constexpr unsigned int priorityChannel1() { return 0x0002; }
static constexpr unsigned int priorityChannel1Index() { return 0x0004; }
static constexpr unsigned int priorityChannel2() { return 0x0003; }
static constexpr unsigned int priorityChannel2Index() { return 0x0006; }
static constexpr unsigned int revertChannel() { return 0x0008; }
static constexpr unsigned int revertChannelIndex() { return 0x000a; }
static constexpr unsigned int memberCount() { return 0x0001; }
static constexpr unsigned int memberIndices() { return 0x0030; }
/// @endcond
};
public:
/** Some limits. */
struct Limit {
/** Maximum length of the name. */
static constexpr unsigned int nameLength() { return 32; }
/** Maximum number of channels in scan list. */
static constexpr unsigned int memberCount() { return 16; }
};
};
/** Implements the binary encoding of the scan-list bank.
*
* Holds up to 10 @c DR1801UVCodeplug::ScanListElement.
*
* Memory representation of the scan list bank (324h bytes):
* @verbinclude dr1801uv_scanlistbankelement.txt */
class ScanListBankElement: public Element
{
protected:
/** Hidden constructor. */
ScanListBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
ScanListBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00324; }
/** Returns the number of scan lists. */
virtual unsigned int scanListCount() const;
/** Sets the number of scan lists. */
virtual void setScanListCount(unsigned int count);
/** Returns a reference to the n-th scan list. */
virtual ScanListElement scanList(unsigned int index) const;
/** Decodes all scan lists. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links the scan lists. */
virtual bool link(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all scan lists. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int scanListCount() { return 0x0000; }
static constexpr unsigned int scanLists() { return 0x0004; }
/// @endcond
};
public:
/** Some limits. */
struct Limit {
/** Maximum number of scan lists. */
static constexpr unsigned int scanListCount() { return 10; }
};
};
/** Implements the binary representation of a single message.
*
* Memory representation of the message element (44h bytes):
* @verbinclude dr1801uv_messageelement.txt */
class MessageElement: public Element
{
protected:
/** Hidden constructor. */
MessageElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
MessageElement(uint8_t *ptr);
void clear();
bool isValid() const;
/** The size of the element. */
static constexpr unsigned int size() { return 0x0044; }
/** Returns the index of the message. */
virtual unsigned int index() const;
/** Sets the index of the message. */
virtual void setIndex(unsigned int index);
/** Returns the message text. */
virtual QString text() const;
/** Sets the message text. */
virtual void setText(const QString &text);
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int index() { return 0x0000; }
static constexpr unsigned int textLength() { return 0x0001; }
static constexpr unsigned int text() { return 0x0004; }
/// @endcond
};
public:
/** Some limits. */
struct Limit {
/** The maximum message length. */
static constexpr unsigned int textLength() { return 64; }
};
};
/** Implements the binary encoding of the preset message bank element.
*
* The message bank contains all messages defined. See @c DR1801UVCodeplug::MessageElement for
* details.
*
* Memory representation of the message bank element (164h bytes):
* @verbinclude dr1801uv_messagebankelement.txt */
class MessageBankElement: public Element
{
protected:
/** Hidden constructor. */
MessageBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
MessageBankElement(uint8_t *ptr);
void clear();
/** Size of the element. */
static constexpr unsigned int size() { return 0x00164; }
/** Returns the number of elements in the bank. */
virtual unsigned int messageCount() const;
/** Sets the number of messages. */
virtual void setMessageCount(unsigned int count);
/** Returns a reference to the n-th message. */
virtual MessageElement message(unsigned int n) const;
/** Decodes all scan lists. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all scan lists. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits. */
struct Limit {
static constexpr unsigned int messageCount() { return 8; } ///< Maximum number of messages.
};
protected:
/** Offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int messageCount() { return 0x0000; }
static constexpr unsigned int messages() { return 0x0004; }
/// @endcond
};
};
/** Implements the binary encoding of the key settings.
*
* Memory representation of the message bank element (0018h bytes):
* @verbinclude dr1801uv_keysettingselement.txt */
class KeySettingsElement: public Element
{
public:
/** Possible key functions. */
enum class Function {
None = 0, ToggleAlertTones = 1, EmergencyOn = 2, EmergencyOff = 3, TogglePower = 4,
Monitor = 5, DeleteNuisance = 6, OneTouch1 = 7, OneTouch2 = 8, OneTouch3 = 9, OneTouch4 = 10,
OneTouch5 = 11, ToggleTalkaround = 13, ToggleScan = 14, ToggleEncryption = 15, ToggleVOX = 16,
ZoneSelect = 17, ToggleLoneWorker = 19, PhoneExit = 20
};
protected:
/** Hidden constructor. */
KeySettingsElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
KeySettingsElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x00018; }
/** Returns the function for the side-key 1, short press. */
virtual Function sideKey1Short() const;
/** Sets the function for the side-key 1, short press. */
virtual void setSideKey1Short(Function func);
/** Returns the function for the side-key 1, long press. */
virtual Function sideKey1Long() const;
/** Sets the function for the side-key 1, long press. */
virtual void setSideKey1Long(Function func);
/** Returns the function for the side-key 2, short press. */
virtual Function sideKey2Short() const;
/** Sets the function for the side-key 2, short press. */
virtual void setSideKey2Short(Function func);
/** Returns the function for the side-key 2, long press. */
virtual Function sideKey2Long() const;
/** Sets the function for the side-key 2, long press. */
virtual void setSideKey2Long(Function func);
/** Returns the function for the top-key, short press. */
virtual Function topKeyShort() const;
/** Sets the function for the top-key, short press. */
virtual void setTopKeyShort(Function func);
/** Returns the function for the top-key, long press. */
virtual Function topKeyLong() const;
/** Sets the function for the side-key, long press. */
virtual void setTopKeyLong(Function func);
protected:
/** Internal offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int sideKey1Short() { return 0x0001; }
static constexpr unsigned int sideKey1Long() { return 0x0002; }
static constexpr unsigned int sideKey2Short() { return 0x0005; }
static constexpr unsigned int sideKey2Long() { return 0x0006; }
static constexpr unsigned int topKeyShort() { return 0x0009; }
static constexpr unsigned int topKeyLong() { return 0x000a; }
/// @endcond
};
};
/** Implements the binary encoding of the VFO settings.
*
* Memory representation of the VFO settings (0090h bytes):
* @verbinclude dr1801uv_vfobankelement.txt */
class VFOBankElement: public Element
{
protected:
/** Hidden constructor. */
VFOBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
VFOBankElement(uint8_t *ptr);
void clear();
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x0090; }
/** Returns a reference to the VFO A settings. */
virtual ChannelElement vfoA() const;
/** Returns a reference to the VFO A settings. */
virtual ChannelElement vfoB() const;
/** Returns the name of the first VFO. */
virtual QString nameA() const;
/** Sets the name for the first VFO. */
virtual void setNameA(const QString &name);
/** Returns the name of the second VFO. */
virtual QString nameB() const;
/** Sets the name for the second VFO. */
virtual void setNameB(const QString &name);
public:
/** Some limits for the element. */
struct Limit {
/** The maximum length of the VFO names (not set). */
static constexpr unsigned int nameLength() { return 20; }
};
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int vfoA() { return 0x0000; }
static constexpr unsigned int vfoB() { return 0x0034; }
static constexpr unsigned int nameA() { return 0x0068; }
static constexpr unsigned int nameB() { return 0x007c; }
/// @endcond
};
};
/** Implements the binary encoding of an encryption key.
*
* Memory representation of the encryption key bank (000ch bytes):
* @verbinclude dr1801uv_encryptionkeyelement.txt */
class EncryptionKeyElement: public Element
{
protected:
/** Hidden constructor. */
EncryptionKeyElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
EncryptionKeyElement(uint8_t *ptr);
void clear();
bool isValid() const;
/** Returns the size of the element. */
static constexpr unsigned int size() { return 0x000c; }
/** Returns the index of the key. */
virtual unsigned int index() const;
/** Sets the index of the key. */
virtual void setIndex(unsigned int index);
/** Returns the length of the key. */
virtual unsigned int keyLength() const;
/** Returns the key as a string. */
virtual QString key() const;
/** Sets the key. */
virtual void setKey(const QString &key);
/** Creates a key object for this element. */
virtual EncryptionKey *toKeyObj(Context &ctx, const ErrorStack &err=ErrorStack());
/** Links the key object. */
virtual bool linkKeyObj(EncryptionKey *obj, Context &ctx, const ErrorStack &err=ErrorStack());
/** Encodes the key. */
virtual bool encode(EncryptionKey *obj, Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits for the element. */
struct Limit {
/** The maximum length of the key. */
static constexpr unsigned int keyLength() { return 8; }
};
protected:
/** Some internal offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int index() { return 0x0000; }
static constexpr unsigned int length() { return 0x0001; }
static constexpr unsigned int key() { return 0x0004; }
/// @endcond
};
};
/** Implements the binary encoding of the encryption keys.
*
* Memory representation of the encryption key bank (0078h bytes):
* @verbinclude dr1801uv_encryptionkeybankelement.txt */
class EncryptionKeyBankElement: public Element
{
protected:
/** Hidden constructor. */
EncryptionKeyBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
EncryptionKeyBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0078;}
/** Returns a reference to the encryption key. */
virtual EncryptionKeyElement key(unsigned int index) const;
/** Decodes the all encryption keys defined. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Links all encryption keys. */
virtual bool link(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all keys. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits for the key bank. */
struct Limit {
/** The number of keys. */
static constexpr unsigned int keyCount() { return 10; }
};
};
/** Implements the DTMF system.
*
* Memory representation of the DTMF system (000ch bytes):
* @verbinclude dr1801uv_dtmfsystemelement.txt */
class DTMFSystemElement: public Element
{
protected:
/** Hidden constructor. */
DTMFSystemElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DTMFSystemElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0c; }
/** Returns @c true if the side-tone is enabled. */
virtual bool sideToneEnabled() const;
/** Enables/disable side-tone. */
virtual void enableSideTone(bool enable);
/** Returns the pre-time in milliseconds. */
virtual unsigned int preTime() const;
/** Sets the pre-time in milliseconds. */
virtual void setPreTime(unsigned int ms);
/** Returns the code duration in milliseconds. */
virtual unsigned int codeDuration() const;
/** Sets the code duration in milliseconds. */
virtual void setCodeDuration(unsigned int ms);
/** Returns the code interval in milliseconds. */
virtual unsigned int codeItervall() const;
/** Sets the code interval in milliseconds. */
virtual void setCodeItervall(unsigned int ms);
/** Returns the reset time in milliseconds. */
virtual unsigned int resetTime() const;
/** Sets the reset time in milliseconds. */
virtual void setResetTime(unsigned int ms);
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int sideTone() { return 0x0000; }
static constexpr unsigned int preTime() { return 0x0002; }
static constexpr unsigned int codeDuration() { return 0x0004; }
static constexpr unsigned int codeIntervall() { return 0x0006; }
static constexpr unsigned int resetTime() { return 0x0008; }
/// @endcond
};
};
/** Implements the DTMF systems bank. Holding all defined DTMF systems
* (see @c DTMFSystemElement).
*
* Memory representation of the DTMF system bank (0034h bytes):
* @verbinclude dr1801uv_dtmfsystembankelement.txt */
class DTMFSystemBankElement: public Element
{
protected:
/** Hidden constructor. */
DTMFSystemBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DTMFSystemBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x34; }
/** Returns the number of DTMF systems. */
virtual unsigned int systemCount() const;
/** Sets the number of DTMF systems. */
virtual void setSystemCount(unsigned int count);
/** Returns a reference to the n-th system. */
virtual DTMFSystemElement system(unsigned int n) const;
public:
/** Some limits. */
struct Limit {
/** The maximum number of DTMF systems. */
static constexpr unsigned int systemCount() { return 4; }
};
protected:
/** Some offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int systemCount() { return 0x0000; }
static constexpr unsigned int systems() { return 0x0004; }
/// @endcond
};
};
/** Implements the DTMF ID.
*
* Memory representation of the DTMF ID (014h bytes):
* @verbinclude dr1801uv_dtmfidelement.txt */
class DTMFIDElement: public Element
{
protected:
/** Hidden constructor. */
DTMFIDElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DTMFIDElement(uint8_t *ptr);
void clear();
/** Size of the element. */
static constexpr unsigned int size() { return 0x0014; }
public:
/** Returns the DTMF code/number. */
virtual QString number() const;
/** Sets the DTMF code/number. */
virtual void setNumber(const QString &number);
/** Some limits. */
struct Limit {
/** The maximum number of digits of the number. */
static constexpr unsigned int numberLength() { return 16; }
};
protected:
/** Returns the length of the number. */
virtual unsigned int numberLength() const;
/** Sets the number length. */
virtual void setNumberLength(unsigned int len);
/** Some internal offset within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int numberLength() { return 0x0000; }
static constexpr unsigned int number() { return 0x0004; }
/// @endcond
};
/** Translation table. */
static QVector<QChar> _bin_dtmf_tab;
};
/** Implements the DTMF ID bank. Holding all defined DTMF IDS
* (@c see DTMFIDElement).
*
* Memory representation of the DTMF ID bank (0144h bytes):
* @verbinclude dr1801uv_dtmfidbankelement.txt */
class DTMFIDBankElement: public Element
{
protected:
/** Hidden constructor. */
DTMFIDBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DTMFIDBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0144; }
/** Returns the number of IDs encoded. */
virtual unsigned int idCount() const;
/** Sets the ID count. */
virtual void setIDCount(unsigned int n);
/** Returns a reference to the n-th ID. */
virtual DTMFIDElement id(unsigned int n) const;
public:
/** Some limits. */
struct Limit {
/** The maximum number of IDs. */
static constexpr unsigned int idCount() { return 16; }
};
protected:
/** Some offsets within the codeplug. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int idCount() { return 0x0000; }
static constexpr unsigned int ids() { return 0x0004; }
/// @endcond
};
};
/** Implements the PTT ID.
*
* Memory representation of the PTT ID (014h bytes):
* @verbinclude dr1801uv_pttidelement.txt */
class PTTIDElement: public Element
{
public:
/** Possible modes of transmission. */
enum class Transmit {
None = 0, Start = 1, End = 2, Both = 3
};
/** Possible ID modes. */
enum class IDMode {
Forbidden = 0, Each = 1, Once = 2
};
protected:
/** Hidden constructor. */
PTTIDElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
PTTIDElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x14; }
/** Returns @c true, if the DTMF system is set. */
virtual bool hasDTMFSystem() const;
/** Returns the DTMF system index. */
virtual unsigned int dtmfSystemIndex() const;
/** Sets the DTMF system index. */
virtual void setDTMFSystemIndex(unsigned int index);
/** Clears the DTMF system. */
virtual void clearDTMFSystem();
/** Returns the ID transmission mode. */
virtual Transmit transmitMode() const;
/** Sets the ID transmission mode. */
virtual void setTransmitMode(Transmit mode);
/** Returns the ID mode. */
virtual IDMode idMode() const;
/** Sets the ID mode. */
virtual void setIDMode(IDMode mode);
/** Returns @c true if the BOT DTMF ID is set. */
virtual bool hasBOTID() const;
/** Returns the BOT DTMF ID index. */
virtual unsigned int botIDIndex() const;
/** Sets the BOT DTMF ID index. */
virtual void setBOTIDIndex(unsigned int index);
/** Clears the BOT DTMF ID index. */
virtual void clearBOTID();
/** Returns @c true if the EOT DTMF ID is set. */
virtual bool hasEOTID() const;
/** Returns the EOT DTMF ID index. */
virtual unsigned int eotIDIndex() const;
/** Sets the EOT DTMF ID index. */
virtual void setEOTIDIndex(unsigned int index);
/** Clears the EOT DTMF ID index. */
virtual void clearEOTID();
protected:
/** Some internal offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int dtmfSystemIndex() { return 0x0000; }
static constexpr unsigned int transmitMode() { return 0x0001; }
static constexpr unsigned int idMode() { return 0x0002; }
static constexpr unsigned int botIDIndex() { return 0x0003; }
static constexpr unsigned int eotIDIndex() { return 0x0004; }
/// @endcond
};
};
/** Implements the encoding of the DTMF PTT IDs. Holding all PTT IDs
* (see @c PTTIDElement).
*
* Memory representation of the PTT ID bank (0104h bytes):
* @verbinclude dr1801uv_pttidbankelement.txt */
class PTTIDBankElement: public Element
{
protected:
/** Hidden constructor. */
PTTIDBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
PTTIDBankElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0104; }
/** Returns the number of PTT IDs defined. */
virtual unsigned int idCount() const;
/** Set the number of PTT IDs. */
virtual void setPTTIDCount(unsigned int n);
/** Returns a reference to the n-th PTT ID. */
virtual PTTIDElement pttID(unsigned int n);
public:
/** Some limits. */
struct Limit {
/** The maximum number of PTT IDs. */
static constexpr unsigned int idCount() { return 16; }
};
protected:
/** Some internal offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int idCount() { return 0x0000; }
static constexpr unsigned int ids() { return 0x0004; }
/// @endcond
};
};
/** Implements the binary encoding of the DTMF signaling settings.
*
* Memory representation of the settings (029ch bytes):
* @verbinclude dr1801uv_dtmfsettingselement.txt */
class DTMFSettingsElement: public Element
{
public:
/** Possible DTMF non-number codes. Usually used as separator and group codes. */
enum class NonNumber {
None = 0, A=0xa, B=0xb, C=0xc, D=0xd, Asterisk=0xe, Gate=0xf
};
/** Possible responses. */
enum class Response {
None=0, Reminder=1, Reply=2, Both=3
};
/** Possible kill actions. */
enum class Kill {
DisableTX = 0, DisableRXandTX = 1
};
protected:
/** Hidden constructor. */
DTMFSettingsElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DTMFSettingsElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x029c; }
/** Returns the DTMF radio ID as a string. */
virtual QString radioID() const;
/** Sets the DTMF radio ID as a string. */
virtual void setRadioID(const QString &id);
/** Returns the DTMF kill code as a string. */
virtual QString killCode() const;
/** Sets the DTMF kill code as a string. */
virtual void setKillCode(const QString &code);
/** Returns the DTMF wake code as a string. */
virtual QString wakeCode() const;
/** Sets the DTMF wake code as a string. */
virtual void setWakeCode(const QString &code);
/** Returns the delimiter code. */
virtual NonNumber delimiter() const;
/** Sets the delimiter code. */
virtual void setDelimiter(NonNumber code);
/** Returns the group code. */
virtual NonNumber groupCode() const;
/** Sets the group code. */
virtual void setGroupCode(NonNumber code);
/** Returns the decode response. */
virtual Response response() const;
/** Sets the decode response. */
virtual void setResponse(Response resp);
/** Returns the auto-reset time in seconds [5,60s]. */
virtual unsigned int autoResetTime() const;
/** Set the auto-reset time in seconds. */
virtual void setAutoResetTime(unsigned int sec);
/** Returns @c true if the kill/wake decoding is endabled. */
virtual bool killWakeEnabled() const;
/** Enables/disables the kill/wake decoding. */
virtual void enableKillWake(bool enable);
/** Returns the kill type. */
virtual Kill killType() const;
/** Sets the kill type. */
virtual void setKillType(Kill type);
/** Returns a reference to the DTMF systems. */
virtual DTMFSystemBankElement dtmfSystems() const;
/** Returns a reference to the DTMF IDs. */
virtual DTMFIDBankElement dtmfIDs() const;
/** Returns a reference to the PTT ID bank. */
virtual PTTIDBankElement pttIDs() const;
public:
/** Some limits. */
struct Limit {
/** The maximum length of the radio ID. */
static constexpr unsigned int radioIDLength() { return 5; }
/** The maximum length of the kill code. */
static constexpr unsigned int killCodeLength() { return 6; }
/** The maximum length of the wake code. */
static constexpr unsigned int wakeCodeLength() { return 6; }
};
protected:
/** Internal offsets within the settings element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int radioID() { return 0x0000; }
static constexpr unsigned int radioIDLength() { return 0x0005; }
static constexpr unsigned int killCode() { return 0x0008; }
static constexpr unsigned int killCodeLength() { return 0x000e; }
static constexpr unsigned int wakeCode() { return 0x0010; }
static constexpr unsigned int wakeCodeLength() { return 0x0016; }
static constexpr unsigned int delimiter() { return 0x0018; }
static constexpr unsigned int groupCode() { return 0x0019; }
static constexpr unsigned int response() { return 0x001a; }
static constexpr unsigned int autoResetTime() { return 0x001b; }
static constexpr unsigned int killWake() { return 0x001c; }
static constexpr unsigned int killType() { return 0x001d; }
static constexpr unsigned int dtmfSystems() { return 0x0020; }
static constexpr unsigned int dtmfIDs() { return 0x0054; }
static constexpr unsigned int pttIDs() { return 0x0198; }
/// @endcond
};
};
/** Implements the binary encoding of the alarm system.
*
* Memory representation of the alarm system (0018h bytes):
* @verbinclude dr1801uv_alarmsystembankelement.txt */
class AlarmSystemElement: public Element
{
protected:
/** Hidden constructor. */
AlarmSystemElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
AlarmSystemElement(uint8_t *ptr);
void clear();
bool isValid() const;
/** The size of the alarm system element. */
static constexpr unsigned int size() { return 0x0018; }
/** Returns the index of the system. */
virtual unsigned int index() const;
/** Sets the index of the element. */
virtual void setIndex(unsigned int index);
/** Clears the index. */
virtual void clearIndex();
/** Returns @c true if the alarm is enabled. */
virtual bool alarmEnabled() const;
/** Enables/disables the alarm. */
virtual void enableAlarm(bool enable);
/** Returns @c true if no alarm channel is specified. */
virtual bool noAlarmChannel() const;
/** Returns @c true if the alarm channel is the current channel. */
virtual bool alarmChannelIsSelected() const;
/** Returns the index of the alarm channel. */
virtual unsigned int alarmChannelIndex() const;
/** Sets the alarm channel index. */
virtual void setAlarmChannelIndex(unsigned int index);
/** Sets the alarm channel to the selected channel. */
virtual void setAlarmChannelSelected();
/** Clears the alarm channel. */
virtual void clearAlarmChannel();
/** Returns the name. */
virtual QString name() const;
/** Sets the system name. */
virtual void setName(const QString &name);
public:
/** Some limits. */
struct Limit {
/** The maximum name length. */
static constexpr unsigned int nameLength() { return 16; }
};
protected:
/** Some internal offsets within the codeplug. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int index() { return 0x0000; }
static constexpr unsigned int alarmEnabled() { return 0x0001; }
static constexpr unsigned int alarmChannelIndex() { return 0x0004; }
static constexpr unsigned int name() { return 0x0008; }
/// @endcond
};
};
/** Implements the binary encoding of the alarm system bank.
*
* Holding all alarm systems, see @c AlarmSystemElement.
*
* Memory representation of the alarm system bank (00c4h bytes):
* @verbinclude dr1801uv_alarmsystembankelement.txt */
class AlarmSystemBankElement: public Element
{
protected:
/** Hidden constructor. */
AlarmSystemBankElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
AlarmSystemBankElement(uint8_t *ptr);
void clear();
/** The size of the alarm system bank. */
static constexpr unsigned int size() { return 0x00c4; }
/** Returns the number of alarm systems defined. */
virtual unsigned int alarmSystemCount() const;
/** Sets the number of alarm systems. */
virtual void setAlarmSystemCount(unsigned int n);
/** Returns a reference to the n-th alarm system. */
virtual AlarmSystemElement alarmSystem(unsigned int n) const;
public:
/** Some limits. */
struct Limit {
/** The maximum number of alarm systems. */
static constexpr unsigned int alarmSystemCount() { return 8; }
};
protected:
/** Some internal offsets within the element. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int alarmSystemCount() { return 0x0000; }
static constexpr unsigned int alarmSystems() { return 0x0004; }
/// @endcond
};
};
/** Implements the binary encoding of the DMR settings.
*
* Memory representation of the DMR settings (0010h bytes):
* @verbinclude dr1801uv_dmrsettingselement.txt */
class DMRSettingsElement: public Element
{
public:
/** Possible SMS encodings. */
enum class SMSFormat {
CompressedIP = 0, DefinedData = 1, IPData = 2
};
protected:
/** Hidden constructor. */
DMRSettingsElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
DMRSettingsElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0010; }
/** Returns the hold-time in seconds. */
virtual unsigned int holdTime() const;
/** Sets the hold-time in seconds. */
virtual void setHoldTime(unsigned int sec);
/** Returns the remote-listen duration in seconds. */
virtual unsigned int remoteListen() const;
/** Sets the remote-listen duration in seconds. */
virtual void setRemoteListen(unsigned int sec);
/** Returns the active wait period in ms. */
virtual unsigned int activeWait() const;
/** Sets the active wait period in ms. */
virtual void setActiveWait(unsigned int ms);
/** Returns the active resend count. */
virtual unsigned int activeResend() const;
/** Sets the active resend count. */
virtual void setActiveResend(unsigned int count);
/** Returns the pre-send count. */
virtual unsigned int preSend() const;
/** Sets the pre-send count. */
virtual void setPreSend(unsigned int count);
/** Returns the voice head count. */
virtual unsigned int voiceHead() const;
/** Sets the voice head count. */
virtual void setVoiceHead(unsigned int count);
/** Returns the SMS format. */
virtual SMSFormat smsFormat() const;
/** Sets the SMS format. */
virtual void setSMSFormat(SMSFormat format);
/** Returns @c true if the kill encoding is enabled. */
virtual bool killEnc() const;
/** Enables kill encoding. */
virtual void enableKillEnc(bool enable);
/** Returns @c true if the kill decoding is enabled. */
virtual bool killDec() const;
/** Enables kill decoding. */
virtual void enableKillDec(bool enable);
/** Returns @c true if the active encoding is enabled. */
virtual bool activeEnc() const;
/** Enables active encoding. */
virtual void enableActiveEnc(bool enable);
/** Returns @c true if the active decoding is enabled. */
virtual bool activeDec() const;
/** Enables active decoding. */
virtual void enableActiveDec(bool enable);
/** Returns @c true if the check encoding is enabled. */
virtual bool checkEnc() const;
/** Enables check encoding. */
virtual void enableCheckEnc(bool enable);
/** Returns @c true if the check decoding is enabled. */
virtual bool checkDec() const;
/** Enables check decoding. */
virtual void enableCheckDec(bool enable);
/** Returns @c true if the call alter encoding is enabled. */
virtual bool callAlterEnc() const;
/** Enables call alter encoding. */
virtual void enableCallAlterEnc(bool enable);
/** Returns @c true if the call alter decoding is enabled. */
virtual bool callAlterDec() const;
/** Enables call alter decoding. */
virtual void enableCallAlterDec(bool enable);
/** Returns @c true if the remote monitor encoding is enabled. */
virtual bool remoteMonitorEnc() const;
/** Enables remote monitor encoding. */
virtual void enableRemoteMonitorEnc(bool enable);
/** Returns @c true if the remote monitor decoding is enabled. */
virtual bool remoteMonitorDec() const;
/** Enables remote monitor decoding. */
virtual void enableRemoteMonitorDec(bool enable);
/** Decodes the DMR settings. */
virtual bool decode(Context &ctx, const ErrorStack &err=ErrorStack()) const;
/** Encodes all keys. */
virtual bool encode(Context &ctx, const ErrorStack &err=ErrorStack());
public:
/** Some limits. */
struct Limit: public Element::Limit {
/** The range of hold time. */
static constexpr Range<unsigned int> holdTime() { return {1, 90}; }
/** The range of remote listen duration. */
static constexpr Range<unsigned int> remoteListen() { return {10, 120}; }
/** The range of active wait period. */
static constexpr Range<unsigned int> activeWait() { return {120, 600}; }
/** The range of active resend count. */
static constexpr Range<unsigned int> activeResend() { return {1, 10}; }
/** The range of pre-send count. */
static constexpr Range<unsigned int> preSend() { return {4, 15}; }
/** The range of voice head count. */
static constexpr Range<unsigned int> voiceHead() { return {0, 20}; }
};
protected:
/** Internal offsets within the element. */
struct Offset: public Element::Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int holdTime() { return 0x0000; }
static constexpr unsigned int remoteListen() { return 0x0001; }
static constexpr unsigned int activeWait() { return 0x0002; }
static constexpr unsigned int activeResend() { return 0x0003; }
static constexpr unsigned int preSend() { return 0x0004; }
static constexpr unsigned int killEnc() { return 0x0005; }
static constexpr unsigned int activeEnc() { return 0x0006; }
static constexpr unsigned int checkEnc() { return 0x0007; }
static constexpr unsigned int killDec() { return 0x0008; }
static constexpr unsigned int activeDec() { return 0x0009; }
static constexpr unsigned int checkDec() { return 0x000a; }
static constexpr unsigned int smsFormat() { return 0x000b; }
static constexpr unsigned int voiceHead() { return 0x000c; }
static constexpr Bit callAlterEnc() { return {0x000d, 0}; }
static constexpr Bit callAlterDec() { return {0x000d, 1}; }
static constexpr Bit remoteMonitorEnc() { return {0x000d, 2}; }
static constexpr Bit remoteMonitorDec() { return {0x000d, 3}; }
/// @endcond
};
};
/** Implements the binary encoding of a one-touch setting.
*
* Memory representation of the one-touch setting (0008h bytes):
* @verbinclude dr1801uv_onetouchsettingelement.txt */
class OneTouchSettingElement: public Element
{
public:
/** Possible actions to perform. */
enum class Action {
Call = 0, Message = 1
};
/** Possible one-touch types. */
enum class Type {
Disabled = 0, DMR=1, FM=2
};
protected:
/** Hidden constructor. */
OneTouchSettingElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
OneTouchSettingElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0008; }
/** Returns @c true if the setting is enabled. */
bool isValid() const;
/** Returns @c true if a contact is set. */
virtual bool hasContact() const;
/** Returns the DMR contact index. */
virtual unsigned int contactIndex() const;
/** Sets the contact index. */
virtual void setContactIndex(unsigned int index);
/** Clears the contact. */
virtual void clearContact();
/** Returns the one-touch action. */
virtual Action action() const;
/** Sets the one-touch action. */
virtual void setAction(Action action);
/** Returns @c true, if a message is set. */
virtual bool hasMessage() const;
/** Returns the message index. */
virtual unsigned int messageIndex() const;
/** Sets the message index. */
virtual void setMessageIndex(unsigned int index);
/** Clears the message. */
virtual void clearMessage();
/** Returns the type of the one-touch setting. */
virtual Type type() const;
/** Sets the type of the one-touch setting. */
virtual void setType(Type type);
/** Returns @c true if a DTMF ID is set. */
virtual bool hasDTMFID() const;
/** Returns the DTMF ID index. */
virtual unsigned int dtmfIDIndex() const;
/** Sets the DTMF ID index. */
virtual void setDTMFIDIndex(unsigned int index);
/** Clears the DTMF ID index. */
virtual void clearDTMFIDIndex();
protected:
/** Some internal offsets. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int contactIndex() { return 0x0000; }
static constexpr unsigned int action() { return 0x0002; }
static constexpr unsigned int messageIndex() { return 0x0003; }
static constexpr unsigned int type() { return 0x0004; }
static constexpr unsigned int dtmfIDIndex() { return 0x0005; }
/// @endcond
};
};
/** Implements the binary encoding of the one-touch settings.
*
* Holding all one-touch settings, see @c OneTouchSettingElement.
*
* Memory representation of the one-touch settings (0028h bytes):
* @verbinclude dr1801uv_onetouchsettingselement.txt */
class OneTouchSettingsElement: public Element
{
protected:
/** Hidden constructor. */
OneTouchSettingsElement(uint8_t *ptr, size_t size);
public:
/** Constructor. */
OneTouchSettingsElement(uint8_t *ptr);
void clear();
/** The size of the element. */
static constexpr unsigned int size() { return 0x0028; }
/** Returns the number of one-touch settings. */
virtual unsigned int settingsCount() const;
/** Returns a reference to the n-th one-touch setting. */
virtual OneTouchSettingElement setting(unsigned int n) const;
public:
/** Some limits. */
struct Limit {
/** Returns the maximum number of one-touch settings. */
static constexpr unsigned int settingsCount() { return 5; }
};
protected:
/** Some internal offset. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int settings() { return 0x0000; }
/// @endcond
};
};
public:
/** Default constructor. */
explicit DR1801UVCodeplug(QObject *parent = nullptr);
Config * preprocess(Config *config, const ErrorStack &err) const;
bool postprocess(Config *config, const ErrorStack &err) const;
bool index(Config *config, Context &ctx, const ErrorStack &err=ErrorStack()) const;
bool encode(Config *config, const Flags &flags, const ErrorStack &err=ErrorStack());
bool decode(Config *config, const ErrorStack &err=ErrorStack());
protected:
/** Decode codeplug elements. */
virtual bool decodeElements(Context &ctx, const ErrorStack &err=ErrorStack());
/** Link decoded elements. */
virtual bool linkElements(Context &ctx, const ErrorStack &err=ErrorStack());
/** Encode all elements. */
virtual bool encodeElements(Context &ctx, const ErrorStack &err=ErrorStack());
protected:
/** Defines the offsets within the codeplug. */
struct Offset {
/// @cond DO_NOT_DOCUMENT
static constexpr unsigned int size() { return 0x1dd90; }
static constexpr unsigned int settings() { return 0x003b4; }
static constexpr unsigned int zoneBank() { return 0x00418; }
static constexpr unsigned int messageBank() { return 0x04110; }
static constexpr unsigned int contactBank() { return 0x04334; }
static constexpr unsigned int scanListBank() { return 0x0a338; }
static constexpr unsigned int channelBank() { return 0x0a65c; }
static constexpr unsigned int keySettings() { return 0x1c6c4; }
static constexpr unsigned int groupListBank() { return 0x1c6dc; }
static constexpr unsigned int encryptionKeyBank() { return 0x1d7e0; }
static constexpr unsigned int dtmfSettings() { return 0x1d858; }
static constexpr unsigned int alarmSettings() { return 0x1daf4; }
static constexpr unsigned int dmrSettings() { return 0x1dbb8; }
static constexpr unsigned int vfoBank() { return 0x1dd00; }
/// @endcond
};
};
#endif // DR1801UVCODEPLUG_HH
|