objc2-io-kit 0.3.2

Bindings to the IOKit framework
Documentation
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
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellstatekey?language=objc)
pub const kAppleClamshellStateKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellState\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellcausessleepkey?language=objc)
pub const kAppleClamshellCausesSleepKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellCausesSleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepwakeuuidkey?language=objc)
pub const kIOPMSleepWakeUUIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SleepWakeUUID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbootsessionuuidkey?language=objc)
pub const kIOPMBootSessionUUIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BootSessionUUID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepenabledkey?language=objc)
pub const kIOPMDeepSleepEnabledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Enabled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelaykey?language=objc)
pub const kIOPMDeepSleepDelayKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Delay\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelayhighkey?language=objc)
pub const kIOPMDeepSleepDelayHighKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"High Standby Delay\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstandbybatterythresholdkey?language=objc)
pub const kIOPMStandbyBatteryThresholdKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Battery Threshold\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdestroyfvkeyonstandbykey?language=objc)
pub const kIOPMDestroyFVKeyOnStandbyKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DestroyFVKeyOnStandby\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmresetpowerstateonwakekey?language=objc)
pub const kIOPMResetPowerStateOnWakeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOPMResetPowerStateOnWake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverkey?language=objc)
pub const kIOPMAssertionsDriverKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertions\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverdetailedkey?language=objc)
pub const kIOPMAssertionsDriverDetailedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertionsDetailed\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionidkey?language=objc)
pub const kIOPMDriverAssertionIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncreatedtimekey?language=objc)
pub const kIOPMDriverAssertionCreatedTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CreatedTime\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmodifiedtimekey?language=objc)
pub const kIOPMDriverAssertionModifiedTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ModifiedTime\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerstringkey?language=objc)
pub const kIOPMDriverAssertionOwnerStringKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Owner\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerservicekey?language=objc)
pub const kIOPMDriverAssertionOwnerServiceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ServicePtr\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionregistryentryidkey?language=objc)
pub const kIOPMDriverAssertionRegistryEntryIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"RegistryEntryID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionlevelkey?language=objc)
pub const kIOPMDriverAssertionLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Level\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionassertedkey?language=objc)
pub const kIOPMDriverAssertionAssertedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Assertions\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageclamshellstatechange?language=objc)
pub const kIOPMMessageClamshellStateChange: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x100);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagefeaturechange?language=objc)
pub const kIOPMMessageFeatureChange: c_uint = iokit_family_msg!(sub_iokit_powermanagement, 0x110);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageinternalbatteryfullydischarged?language=objc)
pub const kIOPMMessageInternalBatteryFullyDischarged: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x120);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesystempowereventoccurred?language=objc)
pub const kIOPMMessageSystemPowerEventOccurred: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x130);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesleepwakeuuidchange?language=objc)
pub const kIOPMMessageSleepWakeUUIDChange: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x140);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedriverassertionschanged?language=objc)
pub const kIOPMMessageDriverAssertionsChanged: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x150);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedarkwakethermalemergency?language=objc)
pub const kIOPMMessageDarkWakeThermalEmergency: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x160);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalconnectedkey?language=objc)
pub const kIOPMPSExternalConnectedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalConnected\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalchargecapablekey?language=objc)
pub const kIOPMPSExternalChargeCapableKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalChargeCapable\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryinstalledkey?language=objc)
pub const kIOPMPSBatteryInstalledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInstalled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsischargingkey?language=objc)
pub const kIOPMPSIsChargingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IsCharging\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfullychargedkey?language=objc)
pub const kIOPMFullyChargedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"FullyCharged\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatwarnlevelkey?language=objc)
pub const kIOPMPSAtWarnLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtWarnLevel\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatcriticallevelkey?language=objc)
pub const kIOPMPSAtCriticalLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtCriticalLevel\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscurrentcapacitykey?language=objc)
pub const kIOPMPSCurrentCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CurrentCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxcapacitykey?language=objc)
pub const kIOPMPSMaxCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsdesigncapacitykey?language=objc)
pub const kIOPMPSDesignCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DesignCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpstimeremainingkey?language=objc)
pub const kIOPMPSTimeRemainingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeRemaining\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsamperagekey?language=objc)
pub const kIOPMPSAmperageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsvoltagekey?language=objc)
pub const kIOPMPSVoltageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscyclecountkey?language=objc)
pub const kIOPMPSCycleCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CycleCount\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxerrkey?language=objc)
pub const kIOPMPSMaxErrKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxErr\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterinfokey?language=objc)
pub const kIOPMPSAdapterInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationkey?language=objc)
pub const kIOPMPSLocationKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Location\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpserrorconditionkey?language=objc)
pub const kIOPMPSErrorConditionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorCondition\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturerkey?language=objc)
pub const kIOPMPSManufacturerKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Manufacturer\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturedatekey?language=objc)
pub const kIOPMPSManufactureDateKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ManufactureDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmodelkey?language=objc)
pub const kIOPMPSModelKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Model\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsserialkey?language=objc)
pub const kIOPMPSSerialKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Serial\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdevicenamekey?language=objc)
pub const kIOPMDeviceNameKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DeviceName\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslegacybatteryinfokey?language=objc)
pub const kIOPMPSLegacyBatteryInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"LegacyBatteryInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryhealthkey?language=objc)
pub const kIOPMPSBatteryHealthKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryHealth\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpshealthconfidencekey?language=objc)
pub const kIOPMPSHealthConfidenceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HealthConfidence\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscapacityestimatedkey?language=objc)
pub const kIOPMPSCapacityEstimatedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CapacityEstimated\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterychargestatuskey?language=objc)
pub const kIOPMPSBatteryChargeStatusKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargeStatus\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterytemperaturekey?language=objc)
pub const kIOPMPSBatteryTemperatureKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Temperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailskey?language=objc)
pub const kIOPMPSAdapterDetailsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterDetails\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpschargerconfigurationkey?language=objc)
pub const kIOPMPSChargerConfigurationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargerConfiguration\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohot?language=objc)
pub const kIOPMBatteryChargeStatusTooHot: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoocold?language=objc)
pub const kIOPMBatteryChargeStatusTooCold: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"LowTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohotorcold?language=objc)
pub const kIOPMBatteryChargeStatusTooHotOrCold: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighOrLowTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatusgradient?language=objc)
pub const kIOPMBatteryChargeStatusGradient: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryTemperatureGradient\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsidkey?language=objc)
pub const kIOPMPSAdapterDetailsIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailswattskey?language=objc)
pub const kIOPMPSAdapterDetailsWattsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Watts\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsrevisionkey?language=objc)
pub const kIOPMPSAdapterDetailsRevisionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterRevision\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsserialnumberkey?language=objc)
pub const kIOPMPSAdapterDetailsSerialNumberKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SerialNumber\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsfamilykey?language=objc)
pub const kIOPMPSAdapterDetailsFamilyKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"FamilyCode\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsamperagekey?language=objc)
pub const kIOPMPSAdapterDetailsAmperageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsdescriptionkey?language=objc)
pub const kIOPMPSAdapterDetailsDescriptionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Description\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailspmuconfigurationkey?language=objc)
pub const kIOPMPSAdapterDetailsPMUConfigurationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PMUConfiguration\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsvoltage?language=objc)
pub const kIOPMPSAdapterDetailsVoltage: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterVoltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssourceidkey?language=objc)
pub const kIOPMPSAdapterDetailsSourceIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Source\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailserrorflagskey?language=objc)
pub const kIOPMPSAdapterDetailsErrorFlagsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorFlags\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssharedsourcekey?language=objc)
pub const kIOPMPSAdapterDetailsSharedSourceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SharedSource\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailscloakedkey?language=objc)
pub const kIOPMPSAdapterDetailsCloakedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CloakedSource\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsinvalidwakesecondskey?language=objc)
pub const kIOPMPSInvalidWakeSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInvalidWakeSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostchargewaitsecondskey?language=objc)
pub const kIOPMPSPostChargeWaitSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostChargeWaitSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostdishargewaitsecondskey?language=objc)
pub const kIOPMPSPostDishargeWaitSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostDischargeWaitSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitskey?language=objc)
pub const kIOPMGraphicsPowerLimitsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Limits\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitperformancekey?language=objc)
pub const kIOPMGraphicsPowerLimitPerformanceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Performance\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitskey?language=objc)
pub const kIOPMCPUPowerLimitsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Power_Limits\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorspeedkey?language=objc)
pub const kIOPMCPUPowerLimitProcessorSpeedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Speed_Limit\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorcountkey?language=objc)
pub const kIOPMCPUPowerLimitProcessorCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Available_CPUs\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitschedulertimekey?language=objc)
pub const kIOPMCPUPowerLimitSchedulerTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Scheduler_Limit\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarningkey?language=objc)
pub const kIOPMThermalLevelWarningKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Thermal_Level_Warning\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelnormal?language=objc)
pub const kIOPMThermalWarningLevelNormal: c_uint = kIOPMThermalLevelNormal;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningleveldanger?language=objc)
pub const kIOPMThermalWarningLevelDanger: c_uint = kIOPMThermalLevelWarning;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelcrisis?language=objc)
pub const kIOPMThermalWarningLevelCrisis: c_uint = kIOPMThermalLevelCritical;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonringkey?language=objc)
pub const kIOPMSettingWakeOnRingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Modem Ring\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingrestartonpowerlosskey?language=objc)
pub const kIOPMSettingRestartOnPowerLossKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Automatic Restart On Power Loss\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonacchangekey?language=objc)
pub const kIOPMSettingWakeOnACChangeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On AC Change\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingsleeponpowerbuttonkey?language=objc)
pub const kIOPMSettingSleepOnPowerButtonKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Sleep On Power Button\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonclamshellkey?language=objc)
pub const kIOPMSettingWakeOnClamshellKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Clamshell Open\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingreducebrightnesskey?language=objc)
pub const kIOPMSettingReduceBrightnessKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ReduceBrightness\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdisplaysleepusesdimkey?language=objc)
pub const kIOPMSettingDisplaySleepUsesDimKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Display Sleep Uses Dim\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingtimezoneoffsetkey?language=objc)
pub const kIOPMSettingTimeZoneOffsetKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeZoneOffsetSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmobilemotionmodulekey?language=objc)
pub const kIOPMSettingMobileMotionModuleKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MobileMotionModule\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettinggraphicsswitchkey?language=objc)
pub const kIOPMSettingGraphicsSwitchKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"GPUSwitch\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodecontrol?language=objc)
pub const kIOPMSettingProModeControl: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeControl\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodedefer?language=objc)
pub const kIOPMSettingProModeDefer: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeDefer\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakesecondskey?language=objc)
pub const kIOPMSettingAutoWakeSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakecalendarkey?language=objc)
pub const kIOPMSettingAutoWakeCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeByCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowersecondskey?language=objc)
pub const kIOPMSettingAutoPowerSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowercalendarkey?language=objc)
pub const kIOPMSettingAutoPowerCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerByCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugwakerelativekey?language=objc)
pub const kIOPMSettingDebugWakeRelativeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeRelativeToSleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugpowerrelativekey?language=objc)
pub const kIOPMSettingDebugPowerRelativeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerRelativeToShutdown\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmaintenancewakecalendarkey?language=objc)
pub const kIOPMSettingMaintenanceWakeCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaintenanceWakeCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kmaxtype?language=objc)
pub const kMaxType: c_uint = kPMLastAggressivenessType - 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kioremsleepenabledkey?language=objc)
pub const kIOREMSleepEnabledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"REMSleepEnabled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinfokey?language=objc)
pub const kIOBatteryInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOBatteryInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycurrentchargekey?language=objc)
pub const kIOBatteryCurrentChargeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycapacitykey?language=objc)
pub const kIOBatteryCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Capacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryflagskey?language=objc)
pub const kIOBatteryFlagsKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Flags\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryvoltagekey?language=objc)
pub const kIOBatteryVoltageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryamperagekey?language=objc)
pub const kIOBatteryAmperageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycyclecountkey?language=objc)
pub const kIOBatteryCycleCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Cycle Count\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagebatterystatushaschanged?language=objc)
pub const kIOPMMessageBatteryStatusHasChanged: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x100);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautowake?language=objc)
pub const kIOPMUMessageLegacyAutoWake: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x200);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautopower?language=objc)
pub const kIOPMUMessageLegacyAutoPower: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x210);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowake?language=objc)
pub const kIOPMAutoWake: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautopoweron?language=objc)
pub const kIOPMAutoPowerOn: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowakeorpoweron?language=objc)
pub const kIOPMAutoWakeOrPowerOn: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"wakepoweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautosleep?language=objc)
pub const kIOPMAutoSleep: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"sleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautoshutdown?language=objc)
pub const kIOPMAutoShutdown: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"shutdown\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautorestart?language=objc)
pub const kIOPMAutoRestart: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"restart\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtimekey?language=objc)
pub const kIOPMPowerEventTimeKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"time\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventappnamekey?language=objc)
pub const kIOPMPowerEventAppNameKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"scheduledby\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventapppidkey?language=objc)
pub const kIOPMPowerEventAppPIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"appPID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtypekey?language=objc)
pub const kIOPMPowerEventTypeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"eventtype\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetaggressiveness?language=objc)
pub const kPMSetAggressiveness: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetaggressiveness?language=objc)
pub const kPMGetAggressiveness: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystem?language=objc)
pub const kPMSleepSystem: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmallowpowerchange?language=objc)
pub const kPMAllowPowerChange: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmcancelpowerchange?language=objc)
pub const kPMCancelPowerChange: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmshutdownsystem?language=objc)
pub const kPMShutdownSystem: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrestartsystem?language=objc)
pub const kPMRestartSystem: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystemoptions?language=objc)
pub const kPMSleepSystemOptions: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetmaintenancewakecalendar?language=objc)
pub const kPMSetMaintenanceWakeCalendar: c_uint = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetuserassertionlevels?language=objc)
pub const kPMSetUserAssertionLevels: c_uint = 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmactivitytickle?language=objc)
pub const kPMActivityTickle: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetsystemsleeptype?language=objc)
pub const kPMGetSystemSleepType: c_uint = 11;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetclamshellsleepstate?language=objc)
pub const kPMSetClamshellSleepState: c_uint = 12;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakewatchdogenable?language=objc)
pub const kPMSleepWakeWatchdogEnable: c_uint = 13;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakedebugtrig?language=objc)
pub const kPMSleepWakeDebugTrig: c_uint = 14;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaypoweron?language=objc)
pub const kPMSetDisplayPowerOn: c_uint = 15;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaystate?language=objc)
pub const kPMSetDisplayState: c_uint = 16;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrequestidlesleeprevert?language=objc)
pub const kPMRequestIdleSleepRevert: c_uint = 17;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetldmhibernationdisable?language=objc)
pub const kPMSetLDMHibernationDisable: c_uint = 18;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/knumpmmethods?language=objc)
pub const kNumPMMethods: c_uint = 19;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorynotifyname?language=objc)
pub const kIOSystemLoadAdvisoryNotifyName: &CStr = unsafe {
    CStr::from_bytes_with_nul_unchecked(b"com.apple.system.powermanagement.SystemLoadAdvisory\0")
};
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowernotificationkey?language=objc)
pub const kIOPMCPUPowerNotificationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.CPU\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningnotificationkey?language=objc)
pub const kIOPMThermalWarningNotificationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.thermal_warning\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxpowerstates?language=objc)
pub const kIOPMMaxPowerStates: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxpowerstates?language=objc)
pub const IOPMMaxPowerStates: c_uint = kIOPMMaxPowerStates;

/// Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
///
/// These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
///
/// The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
///
/// The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0.
///
/// The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't.
///
///
///
///
/// Indicates device is in a low power state. May be bitwis-OR'd together
/// with kIOPMDeviceUsable flag, to indicate the device is still usable.
///
/// A device with a capability of kIOPMLowPower may:
/// Require either 0 or kIOPMPowerOn from its power parent
/// Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
/// to its power plane children.
///
/// Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
///
///
/// In the capability field of a power state, disallows idle system sleep while the device is in that state.
///
/// For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active.
///
/// Useful only as a Capability.
///
///
/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
///
///
/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
///
///
/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
///
///
/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
///
///
/// Indicates the initial power state for the device. If
/// <code>
/// initialPowerStateForDomainState()
/// </code>
/// returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's
/// <code>
/// setPowerState()
/// </code>
/// .
///
///
/// An indication that the power flags represent the state of the root power
/// domain. This bit must not be set in the IOPMPowerState structure.
/// Power Management may pass this bit to initialPowerStateForDomainState()
/// to map from a global system state to the desired device state.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpowerflags?language=objc)
pub type IOPMPowerFlags = c_ulong;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweron?language=objc)
pub const kIOPMPowerOn: c_uint = 0x00000002;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeviceusable?language=objc)
pub const kIOPMDeviceUsable: c_uint = 0x00008000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmlowpower?language=objc)
pub const kIOPMLowPower: c_uint = 0x00010000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventidlesleep?language=objc)
pub const kIOPMPreventIdleSleep: c_uint = 0x00000040;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepcapability?language=objc)
pub const kIOPMSleepCapability: c_uint = 0x00000004;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestartcapability?language=objc)
pub const kIOPMRestartCapability: c_uint = 0x00000080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleep?language=objc)
pub const kIOPMSleep: c_uint = 0x00000001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestart?language=objc)
pub const kIOPMRestart: c_uint = 0x00000080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminitialdevicestate?language=objc)
pub const kIOPMInitialDeviceState: c_uint = 0x00000100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrootdomainstate?language=objc)
pub const kIOPMRootDomainState: c_uint = 0x00000200;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclocknormal?language=objc)
pub const kIOPMClockNormal: c_uint = 0x0004;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclockrunning?language=objc)
pub const kIOPMClockRunning: c_uint = 0x0008;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsystemsleep?language=objc)
pub const kIOPMPreventSystemSleep: c_uint = 0x0010;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdoze?language=objc)
pub const kIOPMDoze: c_uint = 0x0400;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp?language=objc)
pub const kIOPMChildClamp: c_uint = 0x0080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp2?language=objc)
pub const kIOPMChildClamp2: c_uint = 0x0200;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotpowermanaged?language=objc)
pub const kIOPMNotPowerManaged: c_uint = 0x0800;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxperformance?language=objc)
pub const kIOPMMaxPerformance: c_uint = 0x4000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpassthrough?language=objc)
pub const kIOPMPassThrough: c_uint = 0x0100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmauxpoweron?language=objc)
pub const kIOPMAuxPowerOn: c_uint = 0x0020;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotattainable?language=objc)
pub const kIOPMNotAttainable: c_uint = 0x0001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcontextretained?language=objc)
pub const kIOPMContextRetained: c_uint = 0x2000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmconfigretained?language=objc)
pub const kIOPMConfigRetained: c_uint = 0x1000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstaticpowervalid?language=objc)
pub const kIOPMStaticPowerValid: c_uint = 0x0800;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsoftsleep?language=objc)
pub const kIOPMSoftSleep: c_uint = 0x0400;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcapabilitiesmask?language=objc)
pub const kIOPMCapabilitiesMask: c_uint = kIOPMPowerOn
    | kIOPMDeviceUsable
    | kIOPMMaxPerformance
    | kIOPMContextRetained
    | kIOPMConfigRetained
    | kIOPMSleepCapability
    | kIOPMRestartCapability;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotattainable?language=objc)
pub const IOPMNotAttainable: c_uint = kIOPMNotAttainable;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpoweron?language=objc)
pub const IOPMPowerOn: c_uint = kIOPMPowerOn;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclocknormal?language=objc)
pub const IOPMClockNormal: c_uint = kIOPMClockNormal;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclockrunning?language=objc)
pub const IOPMClockRunning: c_uint = kIOPMClockRunning;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmauxpoweron?language=objc)
pub const IOPMAuxPowerOn: c_uint = kIOPMAuxPowerOn;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmdeviceusable?language=objc)
pub const IOPMDeviceUsable: c_uint = kIOPMDeviceUsable;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxperformance?language=objc)
pub const IOPMMaxPerformance: c_uint = kIOPMMaxPerformance;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcontextretained?language=objc)
pub const IOPMContextRetained: c_uint = kIOPMContextRetained;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmconfigretained?language=objc)
pub const IOPMConfigRetained: c_uint = kIOPMConfigRetained;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotpowermanaged?language=objc)
pub const IOPMNotPowerManaged: c_uint = kIOPMNotPowerManaged;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsoftsleep?language=objc)
pub const IOPMSoftSleep: c_uint = kIOPMSoftSleep;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnexthigherstate?language=objc)
pub const kIOPMNextHigherState: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmhigheststate?language=objc)
pub const kIOPMHighestState: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnextlowerstate?language=objc)
pub const kIOPMNextLowerState: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmloweststate?language=objc)
pub const kIOPMLowestState: c_uint = 4;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnexthigherstate?language=objc)
pub const IOPMNextHigherState: c_uint = kIOPMNextHigherState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmhigheststate?language=objc)
pub const IOPMHighestState: c_uint = kIOPMHighestState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnextlowerstate?language=objc)
pub const IOPMNextLowerState: c_uint = kIOPMNextLowerState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmloweststate?language=objc)
pub const IOPMLowestState: c_uint = kIOPMLowestState;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbroadcastaggressiveness?language=objc)
pub const kIOPMBroadcastAggressiveness: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunidledevice?language=objc)
pub const kIOPMUnidleDevice: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunknown?language=objc)
pub const kIOPMUnknown: c_uint = 0xFFFF;

/// kIOPMDriverAssertionCPUBit
/// When set, PM kernel will prefer to leave the CPU and core hardware
/// running in "Dark Wake" state, instead of sleeping.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncpubit?language=objc)
pub const kIOPMDriverAssertionCPUBit: c_uint = 0x01;
/// kIOPMDriverAssertionPreventSystemIdleSleepBit
/// When set, the system should not idle sleep. This does not prevent
/// demand sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventsystemidlesleepbit?language=objc)
pub const kIOPMDriverAssertionPreventSystemIdleSleepBit: c_uint = 0x02;
/// kIOPMDriverAssertionUSBExternalDeviceBit
/// When set, driver is informing PM that an external USB device is attached.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionusbexternaldevicebit?language=objc)
pub const kIOPMDriverAssertionUSBExternalDeviceBit: c_uint = 0x04;
/// kIOPMDriverAssertionBluetoothHIDDevicePairedBit
/// When set, driver is informing PM that a Bluetooth HID device is paired.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionbluetoothhiddevicepairedbit?language=objc)
pub const kIOPMDriverAssertionBluetoothHIDDevicePairedBit: c_uint = 0x08;
/// kIOPMDriverAssertionExternalMediaMountedBit
/// When set, driver is informing PM that an external media is mounted.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionexternalmediamountedbit?language=objc)
pub const kIOPMDriverAssertionExternalMediaMountedBit: c_uint = 0x10;
/// kIOPMDriverAssertionReservedBit5
/// Reserved for Thunderbolt.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit5?language=objc)
pub const kIOPMDriverAssertionReservedBit5: c_uint = 0x20;
/// kIOPMDriverAssertionPreventDisplaySleepBit
/// When set, the display should remain powered on while the system's awake.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventdisplaysleepbit?language=objc)
pub const kIOPMDriverAssertionPreventDisplaySleepBit: c_uint = 0x40;
/// kIOPMDriverAssertionReservedBit7
/// Reserved for storage family.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit7?language=objc)
pub const kIOPMDriverAssertionReservedBit7: c_uint = 0x80;
/// kIOPMDriverAssertionMagicPacketWakeEnabledBit
/// When set, driver is informing PM that magic packet wake is enabled.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmagicpacketwakeenabledbit?language=objc)
pub const kIOPMDriverAssertionMagicPacketWakeEnabledBit: c_uint = 0x100;
/// kIOPMDriverAssertionNetworkKeepAliveActiveBit
/// When set, driver is informing PM that it is holding the network
/// interface up to do TCPKeepAlive
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionnetworkkeepaliveactivebit?language=objc)
pub const kIOPMDriverAssertionNetworkKeepAliveActiveBit: c_uint = 0x200;
/// kIOPMDriverAssertionForceWakeupBit
/// When set, the system will immediately wake up the CPU after going to sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcewakeupbit?language=objc)
pub const kIOPMDriverAssertionForceWakeupBit: c_uint = 0x400;
/// kIOPMDriverAssertionForceFullWakeupBit
/// When set, the system will immediately do a full wakeup after going to sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcefullwakeupbit?language=objc)
pub const kIOPMDriverAssertionForceFullWakeupBit: c_uint = 0x800;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellstatebit?language=objc)
pub const kClamshellStateBit: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellsleepbit?language=objc)
pub const kClamshellSleepBit: c_uint = 1 << 1;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kinflowforciblyenabledbit?language=objc)
pub const kInflowForciblyEnabledBit: c_uint = 1 << 0;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepnow?language=objc)
pub const kIOPMSleepNow: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmallowsleep?language=objc)
pub const kIOPMAllowSleep: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsleep?language=objc)
pub const kIOPMPreventSleep: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbutton?language=objc)
pub const kIOPMPowerButton: c_uint = 1 << 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellclosed?language=objc)
pub const kIOPMClamshellClosed: c_uint = 1 << 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweremergency?language=objc)
pub const kIOPMPowerEmergency: c_uint = 1 << 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdisableclamshell?language=objc)
pub const kIOPMDisableClamshell: c_uint = 1 << 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmenableclamshell?language=objc)
pub const kIOPMEnableClamshell: c_uint = 1 << 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmprocessorspeedchange?language=objc)
pub const kIOPMProcessorSpeedChange: c_uint = 1 << 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmovertemp?language=objc)
pub const kIOPMOverTemp: c_uint = 1 << 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellopened?language=objc)
pub const kIOPMClamshellOpened: c_uint = 1 << 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdwovertemp?language=objc)
pub const kIOPMDWOverTemp: c_uint = 1 << 11;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbuttonup?language=objc)
pub const kIOPMPowerButtonUp: c_uint = 1 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodeengaged?language=objc)
pub const kIOPMProModeEngaged: c_uint = 1 << 13;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodedisengaged?language=objc)
pub const kIOPMProModeDisengaged: c_uint = 1 << 14;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnoerr?language=objc)
pub const kIOPMNoErr: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmackimplied?language=objc)
pub const kIOPMAckImplied: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmwillacklater?language=objc)
pub const kIOPMWillAckLater: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbadspecification?language=objc)
pub const kIOPMBadSpecification: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnosuchstate?language=objc)
pub const kIOPMNoSuchState: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcannotraisepower?language=objc)
pub const kIOPMCannotRaisePower: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmparametererror?language=objc)
pub const kIOPMParameterError: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotyetinitialized?language=objc)
pub const kIOPMNotYetInitialized: c_uint = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnoerr?language=objc)
pub const IOPMNoErr: c_uint = kIOPMNoErr;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmackimplied?language=objc)
pub const IOPMAckImplied: c_uint = kIOPMAckImplied;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmwillacklater?language=objc)
pub const IOPMWillAckLater: c_uint = kIOPMWillAckLater;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmbadspecification?language=objc)
pub const IOPMBadSpecification: c_uint = kIOPMBadSpecification;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnosuchstate?language=objc)
pub const IOPMNoSuchState: c_uint = kIOPMNoSuchState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcannotraisepower?language=objc)
pub const IOPMCannotRaisePower: c_uint = kIOPMCannotRaisePower;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmparametererror?language=objc)
pub const IOPMParameterError: c_uint = kIOPMParameterError;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotyetinitialized?language=objc)
pub const IOPMNotYetInitialized: c_uint = kIOPMNotYetInitialized;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationleft?language=objc)
pub const kIOPMPSLocationLeft: c_uint = 1001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationright?language=objc)
pub const kIOPMPSLocationRight: c_uint = 1002;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmundefinedvalue?language=objc)
pub const kIOPMUndefinedValue: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoorvalue?language=objc)
pub const kIOPMPoorValue: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfairvalue?language=objc)
pub const kIOPMFairValue: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgoodvalue?language=objc)
pub const kIOPMGoodValue: c_uint = 3;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodedisconnected?language=objc)
pub const kIOPSFamilyCodeDisconnected: c_int = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodefirewire?language=objc)
pub const kIOPSFamilyCodeFirewire: c_int = iokit_family_err!(sub_iokit_firewire, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhost?language=objc)
pub const kIOPSFamilyCodeUSBHost: c_int = iokit_family_err!(sub_iokit_usb, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhostsuspended?language=objc)
pub const kIOPSFamilyCodeUSBHostSuspended: c_int = iokit_family_err!(sub_iokit_usb, 1);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbdevice?language=objc)
pub const kIOPSFamilyCodeUSBDevice: c_int = iokit_family_err!(sub_iokit_usb, 2);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbadapter?language=objc)
pub const kIOPSFamilyCodeUSBAdapter: c_int = iokit_family_err!(sub_iokit_usb, 3);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdedicated?language=objc)
pub const kIOPSFamilyCodeUSBChargingPortDedicated: c_int = iokit_family_err!(sub_iokit_usb, 4);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdownstream?language=objc)
pub const kIOPSFamilyCodeUSBChargingPortDownstream: c_int = iokit_family_err!(sub_iokit_usb, 5);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingport?language=objc)
pub const kIOPSFamilyCodeUSBChargingPort: c_int = iokit_family_err!(sub_iokit_usb, 6);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbunknown?language=objc)
pub const kIOPSFamilyCodeUSBUnknown: c_int = iokit_family_err!(sub_iokit_usb, 7);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcbrick?language=objc)
pub const kIOPSFamilyCodeUSBCBrick: c_int = iokit_family_err!(sub_iokit_usb, 8);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbctypec?language=objc)
pub const kIOPSFamilyCodeUSBCTypeC: c_int = iokit_family_err!(sub_iokit_usb, 9);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcpd?language=objc)
pub const kIOPSFamilyCodeUSBCPD: c_int = iokit_family_err!(sub_iokit_usb, 10);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeac?language=objc)
pub const kIOPSFamilyCodeAC: c_int = iokit_family_err!(sub_iokit_pmu, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal?language=objc)
pub const kIOPSFamilyCodeExternal: c_int = iokit_family_err!(sub_iokit_pmu, 1);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal2?language=objc)
pub const kIOPSFamilyCodeExternal2: c_int = iokit_family_err!(sub_iokit_pmu, 2);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal3?language=objc)
pub const kIOPSFamilyCodeExternal3: c_int = iokit_family_err!(sub_iokit_pmu, 3);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal4?language=objc)
pub const kIOPSFamilyCodeExternal4: c_int = iokit_family_err!(sub_iokit_pmu, 4);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal5?language=objc)
pub const kIOPSFamilyCodeExternal5: c_int = iokit_family_err!(sub_iokit_pmu, 5);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal6?language=objc)
pub const kIOPSFamilyCodeExternal6: c_int = iokit_family_err!(sub_iokit_pmu, 6);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal7?language=objc)
pub const kIOPSFamilyCodeExternal7: c_int = iokit_family_err!(sub_iokit_pmu, 7);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal8?language=objc)
pub const kIOPSFamilyCodeExternal8: c_int = iokit_family_err!(sub_iokit_pmu, 8);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeunsupportedregion?language=objc)
pub const kIOPSFamilyCodeUnsupportedRegion: c_int = iokit_family_err!(sub_iokit_pmu, 9);

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagnoerrors?language=objc)
pub const kIOPSAdapterErrorFlagNoErrors: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflaginsufficientavailablepower?language=objc)
pub const kIOPSAdapterErrorFlagInsufficientAvailablePower: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagforeignobjectdetected?language=objc)
pub const kIOPSAdapterErrorFlagForeignObjectDetected: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagdeviceneedstoberepositioned?language=objc)
pub const kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned: c_uint = 1 << 3;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelnormal?language=objc)
pub const kIOPMThermalLevelNormal: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveldanger?language=objc)
pub const kIOPMThermalLevelDanger: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelcritical?language=objc)
pub const kIOPMThermalLevelCritical: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarning?language=objc)
pub const kIOPMThermalLevelWarning: c_uint = 100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveltrap?language=objc)
pub const kIOPMThermalLevelTrap: c_uint = 110;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelunknown?language=objc)
pub const kIOPMThermalLevelUnknown: c_uint = 255;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcalendarstruct?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPMCalendarStruct {
    pub year: u32,
    pub month: u8,
    pub day: u8,
    pub hour: u8,
    pub minute: u8,
    pub second: u8,
    pub selector: u8,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMCalendarStruct {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPMCalendarStruct",
        &[
            <u32>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMCalendarStruct {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgeneralaggressiveness?language=objc)
pub const kPMGeneralAggressiveness: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestodim?language=objc)
pub const kPMMinutesToDim: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestospindown?language=objc)
pub const kPMMinutesToSpinDown: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestosleep?language=objc)
pub const kPMMinutesToSleep: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmethernetwakeonlansettings?language=objc)
pub const kPMEthernetWakeOnLANSettings: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetprocessorspeed?language=objc)
pub const kPMSetProcessorSpeed: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmpowersource?language=objc)
pub const kPMPowerSource: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmmotionsensor?language=objc)
pub const kPMMotionSensor: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmlastaggressivenesstype?language=objc)
pub const kPMLastAggressivenessType: c_uint = 8;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminternalpower?language=objc)
pub const kIOPMInternalPower: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmexternalpower?language=objc)
pub const kIOPMExternalPower: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinstalled?language=objc)
pub const kIOBatteryInstalled: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycharge?language=objc)
pub const kIOBatteryCharge: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterychargerconnect?language=objc)
pub const kIOBatteryChargerConnect: c_uint = 1 << 0;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacinstalled?language=objc)
pub const kIOPMACInstalled: c_uint = kIOBatteryChargerConnect;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterycharging?language=objc)
pub const kIOPMBatteryCharging: c_uint = kIOBatteryCharge;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryinstalled?language=objc)
pub const kIOPMBatteryInstalled: c_uint = kIOBatteryInstalled;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmupsinstalled?language=objc)
pub const kIOPMUPSInstalled: c_uint = 1 << 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryatwarn?language=objc)
pub const kIOPMBatteryAtWarn: c_uint = 1 << 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterydepleted?language=objc)
pub const kIOPMBatteryDepleted: c_uint = 1 << 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacnochargecapability?language=objc)
pub const kIOPMACnoChargeCapability: c_uint = 1 << 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrawlowbattery?language=objc)
pub const kIOPMRawLowBattery: c_uint = 1 << 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmforcelowspeed?language=objc)
pub const kIOPMForceLowSpeed: c_uint = 1 << 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclosedclamshell?language=objc)
pub const kIOPMClosedClamshell: c_uint = 1 << 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellstateonwake?language=objc)
pub const kIOPMClamshellStateOnWake: c_uint = 1 << 10;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopowerstatechangenotification?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPowerStateChangeNotification {
    pub powerRef: *mut c_void,
    pub returnValue: c_ulong,
    pub stateNumber: c_ulong,
    pub stateFlags: IOPMPowerFlags,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPowerStateChangeNotification {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPowerStateChangeNotification",
        &[
            <*mut c_void>::ENCODING,
            Encoding::C_ULONG,
            Encoding::C_ULONG,
            <IOPMPowerFlags>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPowerStateChangeNotification {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/sleepwakenote?language=objc)
pub type sleepWakeNote = IOPowerStateChangeNotification;

/// A structure describing a system capability change.
///
/// A system capability change is a system level transition from a set
/// of system capabilities to a new set of system capabilities. Power management
/// sends a
/// <code>
/// kIOMessageSystemCapabilityChange
/// </code>
/// message and provides
/// this structure as the message data (by reference) to
/// <code>
/// gIOPriorityPowerStateInterest
/// </code>
/// clients when system capability
/// changes.
/// Field: notifyRef An identifier for this message notification. Clients with pending
/// I/O can signal completion by calling
/// <code>
/// allowPowerChange()
/// </code>
/// with this
/// value as the argument. Clients that are able to process the notification
/// synchronously should ignore this field.
/// Field: maxWaitForReply A return value to the caller indicating the maximum time in
/// microseconds to wait for the
/// <code>
/// allowPowerChange()
/// </code>
/// call. The default
/// value is zero, which indicates the client processing has finished, and power
/// management should not wait for an
/// <code>
/// allowPowerChange()
/// </code>
/// call.
/// Field: changeFlags Flags will be set to indicate whether the notification precedes
/// the capability change (
/// <code>
/// kIOPMSystemCapabilityWillChange
/// </code>
/// ), or after
/// the capability change has occurred (
/// <code>
/// kIOPMSystemCapabilityDidChange
/// </code>
/// ).
/// Field: __reserved1 Set to zero.
/// Field: fromCapabilities The system capabilities at the start of the transition.
/// Field: toCapabilities The system capabilities at the end of the transition.
/// Field: __reserved2 Set to zero.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsystemcapabilitychangeparameters?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPMSystemCapabilityChangeParameters {
    pub notifyRef: u32,
    pub maxWaitForReply: u32,
    pub changeFlags: u32,
    pub(crate) __reserved1: u32,
    pub fromCapabilities: u32,
    pub toCapabilities: u32,
    pub(crate) __reserved2: [u32; 4],
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMSystemCapabilityChangeParameters {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPMSystemCapabilityChangeParameters",
        &[
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <[u32; 4]>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMSystemCapabilityChangeParameters {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitywillchange?language=objc)
pub const kIOPMSystemCapabilityWillChange: c_uint = 0x01;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitydidchange?language=objc)
pub const kIOPMSystemCapabilityDidChange: c_uint = 0x02;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitycpu?language=objc)
pub const kIOPMSystemCapabilityCPU: c_uint = 0x01;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitygraphics?language=objc)
pub const kIOPMSystemCapabilityGraphics: c_uint = 0x02;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaudio?language=objc)
pub const kIOPMSystemCapabilityAudio: c_uint = 0x04;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitynetwork?language=objc)
pub const kIOPMSystemCapabilityNetwork: c_uint = 0x08;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaot?language=objc)
pub const kIOPMSystemCapabilityAOT: c_uint = 0x10;

/// Finds the Root Power Domain IOService.
///
/// Parameter `master_device_port`: Just pass in MACH_PORT_NULL for master device port.
///
/// Returns: Returns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMFindPowerManagement(
    master_device_port: libc::mach_port_t,
) -> io_connect_t {
    extern "C-unwind" {
        fn IOPMFindPowerManagement(master_device_port: libc::mach_port_t) -> io_connect_t;
    }
    unsafe { IOPMFindPowerManagement(master_device_port) }
}

/// Sets one of the aggressiveness factors in IOKit Power Management.
///
/// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
///
/// Parameter `type`: Specifies which aggressiveness factor is being set.
///
/// Parameter `aggressiveness`: New value of the aggressiveness factor.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSetAggressiveness(
    fb: io_connect_t,
    r#type: c_ulong,
    aggressiveness: c_ulong,
) -> IOReturn {
    extern "C-unwind" {
        fn IOPMSetAggressiveness(
            fb: io_connect_t,
            r#type: c_ulong,
            aggressiveness: c_ulong,
        ) -> IOReturn;
    }
    unsafe { IOPMSetAggressiveness(fb, r#type, aggressiveness) }
}

extern "C-unwind" {
    /// Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.
    ///
    /// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
    ///
    /// Parameter `type`: Specifies which aggressiveness factor is being retrieved.
    ///
    /// Parameter `aggressiveness`: Points to where to store the retrieved value of the aggressiveness factor.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `aggressiveness` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IOPMGetAggressiveness(
        fb: io_connect_t,
        r#type: c_ulong,
        aggressiveness: *mut c_ulong,
    ) -> IOReturn;
}

/// Tells whether the system supports full sleep, or just doze
///
/// Returns: Returns true if the system supports sleep, false if some hardware prevents full sleep.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSleepEnabled() -> bool {
    extern "C-unwind" {
        fn IOPMSleepEnabled() -> libc::boolean_t;
    }
    let ret = unsafe { IOPMSleepEnabled() };
    ret != 0
}

/// Request that the system initiate sleep.
///
/// For security purposes, caller must be root or the console user.
///
/// Parameter `fb`: Port used to communicate to the kernel,  from IOPMFindPowerManagement.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn {
    extern "C-unwind" {
        fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn;
    }
    unsafe { IOPMSleepSystem(fb) }
}

extern "C-unwind" {
    /// Request battery data from the system.
    ///
    /// This API is supported, but not recommended. Developers should prefer to use
    /// the IOPowerSources API. IOPowerSources provides more battery data, and notifications
    /// when battery state changes)
    ///
    /// Parameter `masterPort`: The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL.
    ///
    /// Parameter `info`: A CFArray of CFDictionaries containing raw battery data. Use these keys, defined in IOPM.h
    /// to read from the dictionary:
    /// <pre>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryInfoKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCurrentChargeKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCapacityKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryFlagsKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryVoltageKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryAmperageKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCycleCountKey
    /// ```
    ///
    /// </code>
    /// </pre>
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `info` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IOPMCopyBatteryInfo(
        master_port: libc::mach_port_t,
        info: *mut *const CFArray,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// DEPRECATED - An obsolete method for interacting with driver power state changes.
    ///
    /// This function is obsolete and deprecated. To receive notifications of driver power state changes,
    /// Please use IOServiceAddInterestNotification with interest type gIOGeneralInterest instead.
    ///
    /// # Safety
    ///
    /// - `refcon` must be a valid pointer.
    /// - `the_port_ref` must be a valid pointer.
    /// - `callback` must be implemented correctly.
    /// - `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    #[deprecated]
    pub fn IORegisterApp(
        refcon: *mut c_void,
        the_driver: io_service_t,
        the_port_ref: *mut IONotificationPortRef,
        callback: IOServiceInterestCallback,
        notifier: *mut io_object_t,
    ) -> io_connect_t;
}

extern "C-unwind" {
    /// Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep
    /// &
    /// wake notifications for the system.
    /// Does not provide system shutdown and restart notifications.
    ///
    /// Provides sleep/wake notifications to applications. Requires that applications acknowledge
    /// some, but not all notifications. Register for sleep/wake notifications will deliver these messages
    /// over the sleep/wake lifecycle:
    /// <ul>
    /// <li>
    /// kIOMessageSystemWillSleep is delivered at the point the system is initiating a
    /// non-abortable sleep.
    /// Callers MUST acknowledge this event by calling
    ///
    /// ```text
    ///  IOAllowPowerChange
    /// ```
    ///
    /// .
    /// If a caller does not acknowledge the sleep notification, the sleep will continue anyway after
    /// a 30 second timeout (resulting in bad user experience).
    /// Delivered before any hardware is powered off.
    ///
    /// <li>
    /// kIOMessageSystemWillPowerOn is delivered at early wakeup time, before most hardware has been
    /// powered on. Be aware that any attempts to access disk, network, the display, etc. may result
    /// in errors or blocking your process until those resources become available.
    /// Caller must NOT acknowledge kIOMessageSystemWillPowerOn; the caller must simply return from its handler.
    ///
    /// <li>
    /// kIOMessageSystemHasPoweredOn is delivered at wakeup completion time, after all device drivers and
    /// hardware have handled the wakeup event. Expect this event 1-5 or more seconds after initiating
    /// system wakeup.
    /// Caller must NOT acknowledge kIOMessageSystemHasPoweredOn; the caller must simply return from its handler.
    ///
    /// <li>
    /// kIOMessageCanSystemSleep indicates the system is pondering an idle sleep, but gives apps the
    /// chance to veto that sleep attempt.
    /// Caller must acknowledge kIOMessageCanSystemSleep by calling
    ///
    /// ```text
    ///  IOAllowPowerChange
    /// ```
    ///
    /// or
    ///
    /// ```text
    ///  IOCancelPowerChange
    /// ```
    ///
    /// . Calling IOAllowPowerChange will not veto the sleep; any
    /// app that calls IOCancelPowerChange will veto the idle sleep. A kIOMessageCanSystemSleep
    /// notification will be followed up to 30 seconds later by a kIOMessageSystemWillSleep message.
    /// or a kIOMessageSystemWillNotSleep message.
    ///
    /// <li>
    /// kIOMessageSystemWillNotSleep is delivered when some app client has vetoed an idle sleep
    /// request. kIOMessageSystemWillNotSleep may follow a kIOMessageCanSystemSleep notification,
    /// but will not otherwise be sent.
    /// Caller must NOT acknowledge kIOMessageSystemWillNotSleep; the caller must simply return from its handler.
    /// </ul>
    /// To deregister for sleep/wake notifications, the caller must make two calls, in this order:
    /// <ol>
    /// <li>
    /// Call IODeregisterForSystemPower with the 'notifier' argument returned here.
    /// <li>
    /// Then call IONotificationPortDestroy passing the 'thePortRef' argument
    /// returned here.
    /// </ol>
    ///
    /// Parameter `refcon`: Caller may provide data to receive as an argument to 'callback' on power state changes.
    ///
    /// Parameter `thePortRef`: On return, thePortRef is a pointer to an IONotificationPortRef, which will deliver the power notifications.
    /// The port is allocated by this function and must be later released by the caller (after calling
    /// <code>
    ///
    /// ```text
    ///  IODeregisterForSystemPower
    /// ```
    ///
    /// </code>
    /// ).
    /// The caller should also enable IONotificationPortRef by calling
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortGetRunLoopSource
    /// ```
    ///
    /// </code>
    /// , or
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortGetMachPort
    /// ```
    ///
    /// </code>
    /// , or
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortSetDispatchQueue
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// Parameter `callback`: A c-function which is called during the notification.
    ///
    /// Parameter `notifier`: On success, returns a pointer to a unique notifier which caller must keep and pass to a subsequent call to IODeregisterForSystemPower.
    ///
    /// Returns: Returns a io_connect_t session for the IOPMrootDomain or IO_OBJECT_NULL if request failed.
    /// Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument.
    ///
    /// # Safety
    ///
    /// - `refcon` must be a valid pointer.
    /// - `the_port_ref` must be a valid pointer.
    /// - `callback` must be implemented correctly.
    /// - `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IORegisterForSystemPower(
        refcon: *mut c_void,
        the_port_ref: *mut IONotificationPortRef,
        callback: IOServiceInterestCallback,
        notifier: *mut io_object_t,
    ) -> io_connect_t;
}

extern "C-unwind" {
    /// Disconnects the caller from an IOService after receiving power state change notifications from the IOService. (Caller must also release IORegisterApp's return io_connect_t and returned IONotificationPortRef for complete clean-up).
    ///
    /// Parameter `notifier`: An object from IORegisterApp.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IODeregisterApp(notifier: *mut io_object_t) -> IOReturn;
}

extern "C-unwind" {
    /// Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also destroy the IONotificationPortRef returned from IORegisterForSystemPower.)
    ///
    /// Parameter `notifier`: The object returned from IORegisterForSystemPower.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IODeregisterForSystemPower(notifier: *mut io_object_t) -> IOReturn;
}

/// The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
///
/// Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power. The caller should not call IOAllowPowerChange in response to any messages
/// except for these two.
///
/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
///
/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOAllowPowerChange(
    kernel_port: io_connect_t,
    notification_id: isize,
) -> IOReturn {
    extern "C-unwind" {
        fn IOAllowPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
    }
    unsafe { IOAllowPowerChange(kernel_port, notification_id) }
}

/// The caller denies an idle system sleep power state change.
///
/// Should only called in response to kIOMessageCanSystemSleep messages from IOPMrootDomain. IOCancelPowerChange has no meaning for responding to kIOMessageSystemWillSleep (which is non-abortable) or any other messages.
///
/// When an app responds to a kIOMessageCanSystemSleep message by calling IOCancelPowerChange, the app
/// vetoes the idle sleep request. The system will stay awake.
/// The idle timer will elapse again after a period of inactivity, and the system will
/// send out the same kIOMessageCanSystemSleep message, and interested applications will respond gain.
///
///
/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
///
/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOCancelPowerChange(
    kernel_port: io_connect_t,
    notification_id: isize,
) -> IOReturn {
    extern "C-unwind" {
        fn IOCancelPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
    }
    unsafe { IOCancelPowerChange(kernel_port, notification_id) }
}

extern "C-unwind" {
    /// Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
    ///
    /// This event will be added to the system's queue of power events and stored persistently on disk. The sleep and shutdown events present a graphical warning and allow a console user to cancel the event. Must be called as root.
    ///
    /// Parameter `time_to_wake`: Date and time that the system will power on/off.
    ///
    /// Parameter `my_id`: A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL.
    ///
    /// Parameter `type`: The type of power on you desire, either wake from sleep or power on. Choose from:
    /// <ul>
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoWake
    /// </code>
    /// ) == wake machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoPowerOn
    /// </code>
    /// ) == power on machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoWakeOrPowerOn
    /// </code>
    /// ) == wake or power on,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoSleep
    /// </code>
    /// ) == sleep machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoShutdown
    /// </code>
    /// ) == power off machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoRestart
    /// </code>
    /// ) == restart the machine.
    /// </ul>
    ///
    /// Returns: kIOReturnSuccess on success, otherwise on failure
    ///
    /// # Safety
    ///
    /// - `time_to_wake` might not allow `None`.
    /// - `my_id` might not allow `None`.
    /// - `type` might not allow `None`.
    pub fn IOPMSchedulePowerEvent(
        time_to_wake: Option<&CFDate>,
        my_id: Option<&CFString>,
        r#type: Option<&CFString>,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Cancel a previously scheduled power event.
    ///
    /// Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root.
    ///
    /// Parameter `time_to_wake`: Cancel entry with this date and time.
    ///
    /// Parameter `my_id`: Cancel entry with this name.
    ///
    /// Parameter `type`: Type to cancel
    ///
    /// Returns: kIOReturnSuccess on success, otherwise on failure
    ///
    /// # Safety
    ///
    /// - `time_to_wake` might not allow `None`.
    /// - `my_id` might not allow `None`.
    /// - `type` might not allow `None`.
    pub fn IOPMCancelScheduledPowerEvent(
        time_to_wake: Option<&CFDate>,
        my_id: Option<&CFString>,
        r#type: Option<&CFString>,
    ) -> IOReturn;
}

/// List all scheduled system power events
///
/// Returns a CFArray of CFDictionaries of power events. Each CFDictionary  contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey).
///
/// Returns: A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events.
#[inline]
pub extern "C-unwind" fn IOPMCopyScheduledPowerEvents() -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn IOPMCopyScheduledPowerEvents() -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { IOPMCopyScheduledPowerEvents() };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// Type for AssertionID arguments to
/// <code>
///
/// ```text
///  IOPMAssertionCreateWithProperties
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  IOPMAssertionRelease
/// ```
///
/// </code>
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionid?language=objc)
pub type IOPMAssertionID = u32;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnullassertionid?language=objc)
pub const kIOPMNullAssertionID: c_uint = 0;

/// Type for AssertionLevel argument to IOPMAssertionCreate
///
///
/// Possible values for
/// <code>
/// IOPMAssertionLevel
/// </code>
/// are
/// <code>
///
/// ```text
///  kIOPMAssertionLevelOff
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  kIOPMAssertionLevelOn
/// ```
///
/// </code>
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionlevel?language=objc)
pub type IOPMAssertionLevel = u32;

/// Level for a disabled assertion, passed as an argument to IOPMAssertionCreate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionleveloff?language=objc)
pub const kIOPMAssertionLevelOff: c_uint = 0;
/// Level for an enabled assertion, passed as an argument to IOPMAssertionCreate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionlevelon?language=objc)
pub const kIOPMAssertionLevelOn: c_uint = 255;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmuseractivetype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct IOPMUserActiveType(pub c_uint);
impl IOPMUserActiveType {
    #[doc(alias = "kIOPMUserActiveLocal")]
    pub const Local: Self = Self(0);
    #[doc(alias = "kIOPMUserActiveRemote")]
    pub const Remote: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMUserActiveType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMUserActiveType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C-unwind" {
    /// The preferred API to create a power assertion.
    ///
    /// Creates an IOPMAssertion. This is the preferred API to call to create an assertion.
    /// It allows the caller to specify the Name, Details, and HumanReadableReason at creation time.
    /// There are other keys that can further describe an assertion, but most developers don't need
    /// to use them. Use
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionSetProperty
    /// ```
    ///
    /// </code>
    /// or
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithProperties
    /// ```
    ///
    /// </code>
    /// if you need to specify properties
    /// that aren't available here.
    ///
    ///
    /// Parameter `AssertionType`: An assertion type constant.
    /// Caller must specify this argument.
    ///
    ///
    /// Parameter `Name`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionNameKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller must specify this argument.
    ///
    ///
    /// Parameter `Details`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionDetailsKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller may pass NULL, but it helps power users and administrators identify the
    /// reasons for this assertion.
    ///
    ///
    /// Parameter `HumanReadableReason`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionHumanReadableReasonKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller may pass NULL, but if it's specified OS X may display it to users
    /// to describe the active assertions on their system.
    ///
    ///
    /// Parameter `LocalizationBundlePath`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionLocalizationBundlePathKey
    /// ```
    ///
    /// </code>
    /// .
    /// This bundle path should include a localization for the string
    /// <code>
    /// HumanReadableReason
    /// </code>
    /// Caller may pass NULL, but this argument is required if caller specifies
    /// <code>
    /// HumanReadableReason
    /// </code>
    ///
    ///
    /// Parameter `Timeout`: Specifies a timeout for this assertion. Pass 0 for no timeout.
    ///
    ///
    /// Parameter `TimeoutAction`: Specifies a timeout action. Caller my pass NULL. If a timeout is specified but a TimeoutAction is not,
    /// the default timeout action is
    /// <code>
    /// kIOPMAssertionTimeoutActionTurnOff
    /// </code>
    ///
    ///
    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
    ///
    ///
    /// Returns: kIOReturnSuccess, or another IOKit return code on error.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `name` might not allow `None`.
    /// - `details` might not allow `None`.
    /// - `human_readable_reason` might not allow `None`.
    /// - `localization_bundle_path` might not allow `None`.
    /// - `timeout_action` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithDescription(
        assertion_type: Option<&CFString>,
        name: Option<&CFString>,
        details: Option<&CFString>,
        human_readable_reason: Option<&CFString>,
        localization_bundle_path: Option<&CFString>,
        timeout: CFTimeInterval,
        timeout_action: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Creates an IOPMAssertion with more flexibility than
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithDescription
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// Parameter `AssertionProperties`: Dictionary providing the properties of the assertion that need to be created.
    ///
    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
    ///
    ///
    /// Create a new PM assertion - the caller must specify the type of assertion, initial level, and its
    /// properties as
    ///
    /// ```text
    ///  IOPMAssertionDictionaryKeys
    /// ```
    ///
    /// keys in the
    /// <code>
    /// AssertionProperties
    /// </code>
    /// dictionary.
    /// The following keys are recommend and/or required to be specified in the AssertionProperties
    /// dictionary argument.
    /// <ul>
    /// <li>
    /// REQUIRED:
    /// <code>
    /// kIOPMAssertionTypeKey
    /// </code>
    /// define the assertion type.
    ///
    /// <li>
    /// REQUIRED:
    /// <code>
    /// kIOPMAssertionNameKey
    /// </code>
    /// Caller must describe the name for the activity that
    /// requires the change in behavior provided by the assertion.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionLevelKey
    /// </code>
    /// define an inital value. If not set, assertion is
    /// turned on after creation.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionDetailsKey
    /// </code>
    /// Caller may describe context-specific data about the
    /// assertion.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionHumanReadableReasonKey
    /// </code>
    /// Caller may describe the reason for creating the assertion
    /// in a localizable CFString. This should be a human readable phrase that describes the actions the
    /// calling process is taking while the assertion is held, like "Downloading TV episodes", or "Compiling Projects"
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionLocalizationBundlePathKey
    /// </code>
    /// Caller may provide its bundle's path, where OS X
    /// can localize for GUI display the CFString specified by
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionHumanReadableReasonKey
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionPlugInIDKey
    /// </code>
    /// if the caller is a plugin with a different identity than the process
    /// it's loaded in.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionFrameworkIDKey
    /// </code>
    /// if the caller is a framework acting on behalf of a process.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionTimeoutKey
    /// </code>
    /// The caller may specify a timeout.
    /// </ul>
    ///
    /// # Safety
    ///
    /// - `assertion_properties` generics must be of the correct type.
    /// - `assertion_properties` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithProperties(
        assertion_properties: Option<&CFDictionary>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Declares that the user is active on the system.
    ///
    ///
    /// This causes the display to power on and postpone display sleep,
    /// up to the user's display sleep Energy Saver settings.
    ///
    /// If you need to hold the display awake for a longer period and you know
    /// how long you'd like to hold it, consider taking assertion
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertPreventUserIdleDisplaySleep
    /// ```
    ///
    /// </code>
    /// using
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithDescription
    /// ```
    ///
    /// </code>
    /// API instead.
    ///
    /// No special privileges are necessary to make this call - any process may
    /// call this API. Caller must specify an AssertionName - NULL is not
    /// a valid input.
    ///
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
    /// than 128 characters.
    ///
    ///
    /// Parameter `userType`: This parameter specifies if the active user is located locally in front of the
    /// system or connected to the system over the network. Various components of the system
    /// are maintained at different power levels depending on user location.
    ///
    ///
    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
    /// may call this function again with the unique id retured previously to report continous
    /// user activity. The unique id returned by this function may change on each call depending
    /// on how frequently this function call is repeated and the current display sleep timer value.
    /// If you make this call more than once, track the returned value for
    /// assertionID, and pass it in as an argument on each call.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionDeclareUserActivity(
        assertion_name: Option<&CFString>,
        user_type: IOPMUserActiveType,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// A convenience function for handling remote network clients; this is a wrapper for
    /// holding
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertNetworkClientActive
    /// ```
    ///
    /// </code>
    ///
    ///
    /// Call this whenever you detect activity from your remote network clients.
    /// This call generates an IPC call, and may block.
    ///
    /// On the first invocation, this will populate parameter
    /// <code>
    /// AssertionID
    /// </code>
    /// with a new assertion ID.
    /// You should pass in this returned assertion ID on every access.
    ///
    /// When system is on AC power, every call to
    /// <code>
    /// IOPMDeclareNetworkClientActivity
    /// </code>
    /// prevents system from idle sleeping and from demand sleeping for the duration of
    /// system sleep timer. When system is on Battery power, every call to
    /// <code>
    /// IOPMDeclareNetworkClientActivity
    /// </code>
    /// prevents system from idle sleeping for the
    /// duration of system sleep timer.
    ///
    /// Assertion created by this interface is valid only for the duration of system sleep timer
    /// from the last call. IOKit will disable
    /// <code>
    /// AssertionID
    /// </code>
    /// after that duration.
    ///
    /// If you detect that your remote client is no longer active, please immediately call
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionRelease
    /// ```
    ///
    /// </code>
    /// . Do not wait for the timeout.
    ///
    /// If your process can detect when remote clients are active and idle, you can skip
    /// this API and directly create
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertNetworkClientActive
    /// ```
    ///
    /// </code>
    /// yourself.
    ///
    /// If your remote clients require access to the framebuffer or the GPU, then this
    /// isn't the appropriate call for you. Please see
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionDeclareUserActivity
    /// ```
    ///
    /// </code>
    /// and pass in argument
    /// <code>
    ///
    /// ```text
    ///  kIOPMUserActiveRemote
    /// ```
    ///
    /// </code>
    /// .
    ///
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Serving a podcast"). The name must be less than
    /// 128 characters.
    /// *
    ///
    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
    /// may call this function again with the unique id retured previously to report additional
    /// user activity. The unique id returned by this function may change on each call depending
    /// on how frequently this function call is repeated and the current system sleep timer value.
    /// If you make this call more than once, track the returned value for
    /// assertionID, and pass it in as an argument on each call.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMDeclareNetworkClientActivity(
        assertion_name: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

/// Increments the assertion's retain count.
///
/// Increments the retain count according to CoreFoundation style retain/release semantics.
/// Retain count can be inspected in the assertion's info dictionary at
/// key
/// <code>
///
/// ```text
///  kIOPMAssertionRetainCountKey
/// ```
///
/// </code>
///
/// Parameter `theAssertion`: The assertion ID to retain.
#[inline]
pub extern "C-unwind" fn IOPMAssertionRetain(the_assertion: IOPMAssertionID) {
    extern "C-unwind" {
        fn IOPMAssertionRetain(the_assertion: IOPMAssertionID);
    }
    unsafe { IOPMAssertionRetain(the_assertion) }
}

/// Decrements the assertion's retain count.
///
///
/// If the retain count becomes zero, then this also frees and deactivates
/// the assertion referred to by
/// <code>
/// assertionID
/// </code>
///
/// Calls to
/// <code>
///
/// ```text
///  IOPMAssertionCreate
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  IOPMAssertionRetain
/// ```
///
/// </code>
/// must each be paired with calls to IOPMAssertionRelease.
///
///
/// Parameter `AssertionID`: The assertion_id, returned from IOPMAssertionCreate, to cancel.
///
///
/// Returns: Returns kIOReturnSuccess on success.
#[inline]
pub extern "C-unwind" fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn {
    extern "C-unwind" {
        fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn;
    }
    unsafe { IOPMAssertionRelease(assertion_id) }
}

/// Copies details about an
/// <code>
/// IOPMAssertion
/// </code>
/// .
///
/// Returns a dictionary describing an IOPMAssertion's specifications and current state.
///
/// Parameter `theAssertion`: The assertion ID to copy info about.
///
/// Returns: A dictionary describing the assertion with keys specified in See
///
/// ```text
///  IOPMAssertionDictionaryKeys
/// ```
///
/// .
/// It's the caller's responsibility to release this dictionary.
#[inline]
pub extern "C-unwind" fn IOPMAssertionCopyProperties(
    the_assertion: IOPMAssertionID,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn IOPMAssertionCopyProperties(
            the_assertion: IOPMAssertionID,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { IOPMAssertionCopyProperties(the_assertion) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    /// Sets a property in the assertion.
    ///
    /// Only the process that created an assertion may change its properties.
    ///
    /// Parameter `theAssertion`: The
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionID
    /// ```
    ///
    /// </code>
    /// of the assertion to modify.
    ///
    /// Parameter `theProperty`: The CFString key, from
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionDictionaryKeys
    /// ```
    ///
    /// </code>
    /// to modify.
    ///
    /// Parameter `theValue`: The property to set. The value must match the CF type expected for the specified key.
    ///
    /// Returns: Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnNotPriviliged
    /// ```
    ///
    /// </code>
    /// if the caller doesn't
    /// have permission to modify this assertion.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnNotFound
    /// ```
    ///
    /// </code>
    /// if PM can't locate this assertion.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnError
    /// ```
    ///
    /// </code>
    /// upon an unidentified error.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnSuccess
    /// ```
    ///
    /// </code>
    /// otherwise.
    ///
    /// # Safety
    ///
    /// - `the_property` might not allow `None`.
    /// - `the_value` should be of the correct type.
    /// - `the_value` might not allow `None`.
    pub fn IOPMAssertionSetProperty(
        the_assertion: IOPMAssertionID,
        the_property: Option<&CFString>,
        the_value: Option<&CFType>,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Returns a dictionary listing all assertions, grouped by their owning process.
    ///
    ///
    /// Notes: One process may have multiple assertions. Several processes may
    /// have asserted the same assertion to different levels.
    ///
    ///
    /// Parameter `AssertionsByPID`: On success, this returns a dictionary of assertions per process.
    /// At the top level, keys to the CFDictionary are pids stored as CFNumbers (kCFNumberIntType).
    /// The value associated with each CFNumber pid is a CFArray of active assertions.
    /// Each entry in the CFArray is an assertion represented as a CFDictionary. See the keys
    /// kIOPMAssertionTypeKey and kIOPMAssertionLevelKey.
    /// Caller must CFRelease() this dictionary when done.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success.
    ///
    /// # Safety
    ///
    /// `assertions_by_pid` must be a valid pointer.
    pub fn IOPMCopyAssertionsByProcess(assertions_by_pid: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// Returns a list of available assertions and their system-wide levels.
    ///
    ///
    /// The system-wide level is the maximum of all individual assertions' levels.
    ///
    ///
    /// Parameter `AssertionsStatus`: On success, this returns a CFDictionary of all assertions currently available.
    /// The keys in the dictionary are the assertion types, and the value of each is a CFNumber that
    /// represents the aggregate level for that assertion.  Caller must CFRelease() this dictionary when done.
    ///
    ///
    /// Returns: Returns      kIOReturnSuccess on success.
    ///
    /// # Safety
    ///
    /// `assertions_status` must be a valid pointer.
    pub fn IOPMCopyAssertionsStatus(assertions_status: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// This is a deprecated call to create a power assertion.
    ///
    ///
    /// ```text
    ///  IOPMAssertionCreateWithProperties
    /// ```
    ///
    /// </code>
    /// .
    /// Please use that version of this API instead.
    ///
    ///
    /// No special privileges necessary to make this call - any process may
    /// activate a power assertion.
    ///
    ///
    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
    ///
    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
    ///
    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    #[deprecated]
    pub fn IOPMAssertionCreate(
        assertion_type: Option<&CFString>,
        assertion_level: IOPMAssertionLevel,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// The simplest API to create a power assertion.
    ///
    ///
    /// No special privileges are necessary to make this call - any process may
    /// activate a power assertion. Caller must specify an AssertionName - NULL is not
    /// a valid input.
    ///
    ///
    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
    ///
    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
    /// than 128 characters.
    ///
    ///
    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithName(
        assertion_type: Option<&CFString>,
        assertion_level: IOPMAssertionLevel,
        assertion_name: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

/// Return type for IOGetSystemLoadAdvisory
///
/// Value is one of kIOSystemLoadAdvisoryLevelGreat, kIOSystemLoadAdvisoryLevelOK,
/// or kIOSystemLoadAdvisoryLevelBad.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iosystemloadadvisorylevel?language=objc)
pub type IOSystemLoadAdvisoryLevel = c_int;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelbad?language=objc)
pub const kIOSystemLoadAdvisoryLevelBad: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelok?language=objc)
pub const kIOSystemLoadAdvisoryLevelOK: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelgreat?language=objc)
pub const kIOSystemLoadAdvisoryLevelGreat: c_uint = 3;

/// Returns a hint about whether now would be a good time to perform time-insensitive
/// work.
///
/// Based on user and system load, IOGetSystemLoadAdvisory determines "better" and "worse"
/// times to run optional or time-insensitive CPU or disk work.
///
/// Applications may use this result to avoid degrading the user experience. If it is a
/// "Bad" or "OK" time to perform work, applications should slow down and perform work
/// less aggressively.
///
/// There is no guarantee that the system will ever be in "Great" condition to perform work -
/// all essential work must still be performed even in "Bad", or "OK" times.
/// Completely optional work, such as updating caches, may be postponed indefinitely.
///
/// Note: You may more efficiently read the SystemLoadAdvisory level using notify_get_state() instead
/// of IOGetSystemLoadAdvisory. The results are identical. notify_get_state() requires that you
/// pass the token argument received by registering for SystemLoadAdvisory notifications.
///
///
/// Returns: IOSystemLoadAdvisoryLevel - one of:
/// <ul>
/// <li>
/// kIOSystemLoadAdvisoryLevelGreat - A Good time to perform time-insensitive work.
/// <li>
/// kIOSystemLoadAdvisoryLevelOK - An OK time to perform time-insensitive work.
/// <li>
/// kIOSystemLoadAdvisoryLevelBad - A Bad time to perform time-insensitive work.
/// </ul>
#[inline]
pub extern "C-unwind" fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel {
    extern "C-unwind" {
        fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel;
    }
    unsafe { IOGetSystemLoadAdvisory() }
}

/// Indicates how user activity, battery level, and thermal level each
/// contribute to the overall "SystemLoadAdvisory" level. In the future,
/// this combined level may represent new levels as well.
///
/// See dictionary keys defined above.
///
/// Returns: Returns a CFDictionaryRef, or NULL on error. Caller must release the
/// returned dictionary.
#[inline]
pub extern "C-unwind" fn IOCopySystemLoadAdvisoryDetailed() -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn IOCopySystemLoadAdvisoryDetailed() -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { IOCopySystemLoadAdvisoryDetailed() };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    /// Copy status of all current CPU power levels.
    ///
    /// The returned dictionary may define some of these keys,
    /// as defined in IOPM.h:
    /// <ul>
    /// <li>
    /// kIOPMCPUPowerLimitProcessorSpeedKey
    /// <li>
    /// kIOPMCPUPowerLimitProcessorCountKey
    /// <li>
    /// kIOPMCPUPowerLimitSchedulerTimeKey
    /// </ul>
    ///
    /// Parameter `cpuPowerStatus`: Upon success, a pointer to a dictionary defining CPU power;
    /// otherwise NULL. Pointer will be populated with a newly created dictionary
    /// upon successful return. Caller must release dictionary.
    ///
    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
    /// CPU PowerStatus has not been published.
    ///
    /// # Safety
    ///
    /// `cpu_power_status` must be a valid pointer.
    pub fn IOPMCopyCPUPowerStatus(cpu_power_status: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// Get thermal warning level of the system.
    ///
    /// Returns: An integer pointer declaring the power warning level of the system.
    /// The value of the integer is one of (defined in IOPM.h):
    /// <ul>
    /// <li>
    /// kIOPMThermalWarningLevelNormal
    /// <li>
    /// kIOPMThermalWarningLevelDanger
    /// <li>
    /// kIOPMThermalWarningLevelCrisis
    /// </ul>
    /// Upon success the thermal level value will be found at the
    /// pointer argument.
    ///
    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
    /// thermal warning level has not been published.
    ///
    /// # Safety
    ///
    /// `thermal_level` must be a valid pointer.
    pub fn IOPMGetThermalWarningLevel(thermal_level: *mut u32) -> IOReturn;
}