This commit is contained in:
2022-02-21 15:35:37 +01:00
parent f21e49c520
commit 0ad907f74a
33 changed files with 788 additions and 815 deletions

View File

@@ -11,20 +11,20 @@ class Modem {
public final addr:String;
@:allow(kernel.peripherals)
private function new(nativePeripherals: cc.periphs.Modem.Modem,addr: String) {
private function new(nativePeripherals:cc.periphs.Modem.Modem, addr:String) {
this.nativ = nativePeripherals;
this.addr = addr;
}
public function open(chan: Int) {
public function open(chan:Int) {
nativ.open(chan);
}
public function isOpen(chan: Int): Bool {
public function isOpen(chan:Int):Bool {
return nativ.isOpen(chan);
}
public function close(chan: Int) {
public function close(chan:Int) {
nativ.close(chan);
}
@@ -32,32 +32,32 @@ class Modem {
nativ.closeAll();
}
public function transmit(chan: Int,replyChan: Int,payload: Any) {
nativ.transmit(chan,replyChan,payload);
public function transmit(chan:Int, replyChan:Int, payload:Any) {
nativ.transmit(chan, replyChan, payload);
}
public function isWireless(): Bool {
public function isWireless():Bool {
return nativ.isWireless();
}
public function getNamesRemote():Array<String> {
if (isWireless()){
if (isWireless()) {
throw new Exception("'getNamesRemote' only works with wired modems");
}
return nativ.getNamesRemote().toArray();
}
public function isPresentRemote(name: String): Bool {
if (isWireless()){
public function isPresentRemote(name:String):Bool {
if (isWireless()) {
throw new Exception("'isPresentRemote' only works with wired modems");
}
return nativ.isPresentRemote(name);
}
public function getTypeRemote(name: String): String {
if (isWireless()){
public function getTypeRemote(name:String):String {
if (isWireless()) {
throw new Exception("'getTypeRemote' only works with wired modems");
}
@@ -65,7 +65,7 @@ class Modem {
}
public function hasTypeRemote(name:String, type:String):Bool {
if (isWireless()){
if (isWireless()) {
throw new Exception("'hasTypeRemote' only works with wired modems");
}
@@ -74,16 +74,16 @@ class Modem {
// return nativ.hasRemoteType(name,type);
}
public function getMethodsRemote(name: String): Array<String> {
if (isWireless()){
public function getMethodsRemote(name:String):Array<String> {
if (isWireless()) {
throw new Exception("'getMethodsRemote' only works with wired modems");
}
return nativ.getMethodsRemote(name).toArray();
}
public function callRemote(remoteName: String, method:String):Dynamic {
if (isWireless()){
public function callRemote(remoteName:String, method:String):Dynamic {
if (isWireless()) {
throw new Exception("'callRemote' only works with wired modems");
}
@@ -91,8 +91,8 @@ class Modem {
throw new haxe.exceptions.NotImplementedException();
}
public function getNameLocal(): String {
if (isWireless()){
public function getNameLocal():String {
if (isWireless()) {
throw new Exception("'getNameLocal' only works with wired modems");
}