improved exporter

This commit is contained in:
2023-06-26 19:06:24 +02:00
parent 4dcc060e9a
commit 7bfe594b4b
7 changed files with 118 additions and 82 deletions

View File

@@ -1,14 +1,17 @@
package lib.exporter;
import kernel.peripherals.IPeripheral;
import kernel.log.Log;
using tink.CoreApi;
class Export {
private final exportConfig: ExportConfig;
private final peripheral: IPeripheral;
public function new(exportConfig: IExportable) {
this.exportConfig = exportConfig.export();
public function new<T: IExportable & IPeripheral>(exportPerph: T) {
this.peripheral = exportPerph;
this.exportConfig = exportPerph.export();
}
public function handleRequest(req: Request): Response {
@@ -32,4 +35,12 @@ class Export {
return Get(value);
}
public function getType(): String {
return this.peripheral.getType();
}
public function getAddr(): String {
return this.peripheral.getAddr();
}
}

View File

@@ -3,7 +3,6 @@ package lib.exporter;
import lib.exporter.Response;
typedef ExportConfig = {
type: String,
getDelegates: Map<String, Null<Int>->ValueType>,
// setDelegates: Map<String, (ValueType, Null<Int>)->ValueType>,
}