improved exporter
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user