Skip to content

Commit 4626e1c

Browse files
committedJun 4, 2016
Moved attribute and class constants into API.

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+169
-143
lines changed
 

Diff for: ‎src/main/java/li/cil/oc/api/driver/DeviceInfo.java

+58
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,62 @@ public interface DeviceInfo {
3636
* @return the table of information on this device, or <code>null</code>.
3737
*/
3838
Map<String, String> getDeviceInfo();
39+
40+
/**
41+
* Recommended list of key values for the device info table.
42+
* <p/>
43+
* You are strongly encouraged to at least define <code>class</code>, <code>description</code>,
44+
* <code>vendor</code> and <code>product</code>, to allow a more homogenous experience for the
45+
* end-user reading this information via a script.
46+
* <p/>
47+
* Feel free to be somewhat... flexible with the designated uses of these fields. For example,
48+
* the capacity and size fields have differing meaning depending on the device in OpenComputers
49+
* itself (e.g. they're used for maximum number of characters for graphics cards, width is
50+
* used for bit depth on graphics cards, etc.), just try to stick with what's somewhat logical.
51+
*/
52+
final class DeviceAttribute {
Has a conversation. Original line has a conversation.
53+
public static final String Class = "class"; // device's class (see below), e.g. "processor"
54+
public static final String Description = "description"; // human-readable description of the hardware node, e.g. "Ethernet interface"
55+
public static final String Vendor = "vendor"; // vendor/manufacturer of the device, e.g. "Minecorp Inc."
56+
public static final String Product = "product"; // product name of the device, e.g. "ATY Raderps 4200X"
57+
public static final String Version = "version"; // version/release of the device, e.g. "2.1.0"
58+
public static final String Serial = "serial"; // serial number of the device
59+
public static final String Capacity = "capacity"; // maximum capacity reported by the device, e.g. unformatted size of a disk
60+
public static final String Size = "size"; // actual size of the device, e.g. actual usable space on a disk
61+
public static final String Clock = "clock"; // bus clock (in Hz) of the device, e.g. call speed(s) of a component
62+
public static final String Width = "width"; // address width of the device, in the broadest sense
63+
64+
private DeviceAttribute() {
65+
}
66+
}
67+
68+
/**
69+
* Recommended list of values for the <code>class</code> attribute (see above).
70+
* <p/>
71+
* Again, feel free to be somewhat creative with those. When in doubt, use <code>generic</code>.
72+
*/
73+
final class DeviceClass {
74+
public static final String System = "system"; // used to refer to the whole machine, e.g. "Computer", "Server", "Robot"
75+
public static final String Bridge = "bridge"; // internal bus converter, maybe useful for some low-level archs?
76+
public static final String Memory = "memory"; // memory bank that can contain data, executable code, e.g. RAM, EEPROM
77+
public static final String Processor = "processor"; // execution processor, e.g. CPU, cryptography support
78+
public static final String Address = "address"; // memory address range, e.g. video memory (again, low-level archs maybe?)
79+
public static final String Storage = "storage"; // storage controller, e.g. IDE controller (low-level...)
80+
public static final String Disk = "disk"; // random-access storage device, e.g. floppies
81+
public static final String Tape = "tape"; // sequential-access storage device, e.g. cassette tapes
82+
public static final String Bus = "bus"; // device-connecting bus, e.g. USB
83+
public static final String Network = "network"; // network interface, e.g. ethernet, wlan
84+
public static final String Display = "display"; // display adapter, e.g. graphics cards
85+
public static final String Input = "input"; // user input device, e.g. keyboard, mouse
86+
public static final String Printer = "printer"; // printing device, e.g. printer, 3D-printer
87+
public static final String Multimedia = "multimedia"; // audio/video device, e.g. sound cards
88+
public static final String Communication = "communication"; // line communication device, e.g. modem, serial ports
89+
public static final String Power = "power"; // energy source, e.g. battery, power supply
90+
public static final String Volume = "volume"; // disk volume, e.g. file system
91+
public static final String Generic = "generic"; // generic device (used when no other class is suitable)
92+
93+
private DeviceClass() {
94+
}
95+
}
96+
3997
}

Diff for: ‎src/main/scala/li/cil/oc/Constants.scala

+1-33
Original file line numberDiff line numberDiff line change
@@ -173,39 +173,7 @@ object Constants {
173173

174174
object DeviceInfo {
175175

176-
object DeviceAttribute {
177-
final val Class = "class"
178-
final val Description = "description"
179-
final val Vendor = "vendor"
180-
final val Product = "product"
181-
final val Capacity = "capacity"
182-
final val Size = "size"
183-
final val Clock = "clock"
184-
final val Width = "width"
185-
}
186-
187-
object DeviceClass {
188-
final val System = "system"
189-
final val Bridge = "bridge"
190-
final val Memory = "memory"
191-
final val Processor = "processor"
192-
final val Address = "address"
193-
final val Storage = "storage"
194-
final val Disk = "disk"
195-
final val Tape = "tape"
196-
final val Bus = "bus"
197-
final val Network = "network"
198-
final val Display = "display"
199-
final val Input = "input"
200-
final val Printer = "printer"
201-
final val Multimedia = "multimedia"
202-
final val Communication = "communication"
203-
final val Power = "power"
204-
final val Volume = "volume"
205-
final val Generic = "generic"
206-
}
207-
208-
final val DefaultVendor = "MightPirates GmbH & Co. KG"
176+
final val DefaultVendor = "MightyPirates GmbH & Co. KG"
209177

210178
}
211179

0 commit comments

Comments
 (0)
Please sign in to comment.