big Peripheal refactor
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package kernel.peripherals;
|
||||
|
||||
import cc.Peripheral;
|
||||
import kernel.log.Log;
|
||||
import kernel.net.Package;
|
||||
import kernel.net.INetworkInterface;
|
||||
@@ -7,6 +8,8 @@ import kernel.net.INetworkInterface;
|
||||
using tink.CoreApi;
|
||||
|
||||
class Modem implements INetworkInterface implements IPeripheral {
|
||||
public static inline final TYPE_NAME:String = "modem";
|
||||
|
||||
public final addr:String;
|
||||
public var onMessage(default, null):Signal<{pack:Package,dist:Null<Float>}>;
|
||||
|
||||
@@ -14,9 +17,9 @@ class Modem implements INetworkInterface implements IPeripheral {
|
||||
private final native:cc.periphs.Modem.Modem;
|
||||
|
||||
@:allow(kernel.peripherals)
|
||||
private function new(nativePeripherals:cc.periphs.Modem.Modem, addr:String) {
|
||||
private function new(addr:String) {
|
||||
this.onMessage = onMessageTrigger.asSignal();
|
||||
this.native = nativePeripherals;
|
||||
this.native = Peripheral.wrap(addr);
|
||||
this.addr = addr;
|
||||
|
||||
KernelEvents.instance.onModemMessage.handle(params ->{
|
||||
|
||||
Reference in New Issue
Block a user