Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Collector driver executer
Browse files Browse the repository at this point in the history
  • Loading branch information
Grabli66 committed Sep 25, 2018
1 parent 6a43905 commit 98a978b
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
13 changes: 11 additions & 2 deletions src/collector/appdrivers/teplokom/vkt7like/Vkt7likeDriver.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package collector.appdrivers.teplokom.vkt7like;
import collector.common.task.CollectorActionTask;
import collector.common.appdriver.CollectorMeterDriver;
import collector.protocols.modbus.rtu.ModbusRtuProtocol;
import collector.common.parameters.DeviceAction;
import collector.appdrivers.teplokom.vkt7like.executers.TimeReader;

/**
* Driver for Vkt7 like driver
Expand All @@ -20,7 +22,14 @@ class Vkt7likeDriver extends CollectorMeterDriver {
* Process execute actions. Virtual
* @param action
*/
public override function executeActions(action:Array<CollectorActionTask>):Void {
trace("EXECUTE ACTIONS");
public override function executeActions(actions:Array<CollectorActionTask>):Void {
for (taskAction in actions) {
switch (taskAction.action.actionType) {
case ActionType.ReadDateTime:
// var reader = new TimeReader(executionContext);
// reader.execute();
default:
}
}
}
}
16 changes: 16 additions & 0 deletions src/collector/appdrivers/teplokom/vkt7like/executers/TimeReader.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package collector.appdrivers.teplokom.vkt7like.executers;

import core.time.DateTime;
import collector.common.appdriver.CollectorDriverExecuter;

/**
* Read time
*/
class TimeReader extends CollectorDriverExecuter<DateTime> {
/**
* Constructor
*/
public function new() {
//super();
}
}
8 changes: 8 additions & 0 deletions src/collector/common/appdriver/CollectorDriverExecuter.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package collector.common.appdriver;

/**
* Executer that works in the context of driver
*/
class CollectorDriverExecuter<T> {

}
2 changes: 1 addition & 1 deletion src/collector/common/appdriver/CollectorMeterDriver.hx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class CollectorMeterDriver extends CollectorDriver {
* Process execute actions. Virtual
* @param action
*/
public function executeActions(action:Array<CollectorActionTask>):Void {}
public function executeActions(actions:Array<CollectorActionTask>):Void {}

/**
* Process read current values. Virtual
Expand Down
10 changes: 5 additions & 5 deletions src/collector/common/parameters/DeviceAction.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package collector.common.parameters;
/**
* Action for a state
*/
enum StateAction {
enum ActionType {
/**
* Read date time
*/
Expand All @@ -22,22 +22,22 @@ class DeviceAction {
/**
* Action on device
*/
public final action:StateAction;
public final actionType:ActionType;

/**
* Constructor
* @param action
*/
public function new(action:StateAction) {
this.action = action;
public function new(actionType:ActionType) {
this.actionType = actionType;
}

/**
* Calc hash
* @return Int
*/
public function hashCode():Int {
return action.getIndex();
return actionType.getIndex();
}

/**
Expand Down

0 comments on commit 98a978b

Please sign in to comment.