1 /*
2     This file is part of libnspire.
3 
4     libnspire is free software: you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation, either version 3 of the License, or
7     (at your option) any later version.
8 
9     libnspire is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License
15     along with libnspire.  If not, see <http://www.gnu.org/licenses/>.
16 */
17 module nspire.c.devinfo;
18 import nspire.c.handle;
19 
20 extern (C):
21 
22 enum nspire_battery
23 {
24     NSPIRE_BATT_POWERED = 0,
25     NSPIRE_BATT_LOW = 241,
26     NSPIRE_BATT_OK = 127,
27     NSPIRE_BATT_UNKNOWN = 255
28 }
29 
30 enum nspire_version_index
31 {
32     NSPIRE_VER_OS = 0,
33     NSPIRE_VER_BOOT1 = 1,
34     NSPIRE_VER_BOOT2 = 2,
35 
36     /* Reserved */
37     NSPIRE_VER_MAXNUM = 3
38 }
39 
40 enum nspire_type
41 {
42     NSPIRE_CAS = 14,
43     NSPIRE_NONCAS = 30,
44     NSPIRE_CASCX = 15,
45     NSPIRE_NONCASCX = 31
46 }
47 
48 enum nspire_runlevel
49 {
50     NSPIRE_RUNLEVEL_RECOVERY = 1,
51     NSPIRE_RUNLEVEL_OS = 2
52 }
53 
54 struct nspire_devinfo
55 {
56     /* Flash storage */
57     struct _Anonymous_0
58     {
59         ulong free;
60         ulong total;
61     }
62 
63     _Anonymous_0 storage;
64 
65     /* Memory */
66     struct _Anonymous_1
67     {
68         ulong free;
69         ulong total;
70     }
71 
72     _Anonymous_1 ram;
73 
74     /* Versions */
75     struct _Anonymous_2
76     {
77         ubyte major;
78         ubyte minor;
79         ushort build;
80     }
81 
82     _Anonymous_2[nspire_version_index.NSPIRE_VER_MAXNUM] versions;
83     nspire_type hw_type;
84 
85     /* Power */
86     struct _Anonymous_3
87     {
88         nspire_battery status;
89         ubyte is_charging;
90     }
91 
92     _Anonymous_3 batt;
93     ubyte clock_speed;
94 
95     /* LCD */
96     struct _Anonymous_4
97     {
98         ushort width;
99         ushort height;
100         ubyte bbp;
101         ubyte sample_mode;
102     }
103 
104     _Anonymous_4 lcd;
105 
106     /* File extensions */
107     struct _Anonymous_5
108     {
109         char[8] file;
110         char[8] os;
111     }
112 
113     _Anonymous_5 extensions;
114 
115     /* ID */
116     char[20] device_name;
117     char[28] electronic_id;
118 
119     /* Misc */
120     nspire_runlevel runlevel;
121 }
122 
123 int nspire_device_info (nspire_handle_t* handle, nspire_devinfo* i);
124