added computer perph

This commit is contained in:
Djeeberjr 2023-06-26 19:05:10 +02:00
parent 8333cabdc8
commit f124525d2d

View File

@ -0,0 +1,50 @@
package kernel.peripherals;
import cc.Peripheral;
import kernel.net.Package.NetworkID;
class Computer implements IPeripheral {
public static inline final TYPE_NAME:String = "computer";
private final addr:String;
@:allow(kernel.peripherals)
private function new(addr: String) {
this.addr = addr;
}
public function getAddr():String {
return addr;
}
public function getType():String {
return Computer.TYPE_NAME;
}
public function isOn():Bool {
return Peripheral.call(addr, "isOn");
}
public function getLabel():Null<String> {
return Peripheral.call(addr, "getLabel");
}
/**
Return -1 if no ID set yet
**/
public function getID():NetworkID{
return Peripheral.call(addr, "getID");
}
public function reboot() {
Peripheral.call(addr, "reboot");
}
public function shutdown() {
Peripheral.call(addr, "shutdown");
}
public function turnOn() {
Peripheral.call(addr, "turnOn");
}
}