2017-12-18 22:04:17 +01:00
|
|
|
|
|
|
|
namespace pxsim {
|
|
|
|
|
|
|
|
export class SensorNode extends BaseNode {
|
|
|
|
|
|
|
|
protected mode: number;
|
|
|
|
protected valueChanged: boolean;
|
2018-01-03 07:22:14 +01:00
|
|
|
protected modeChanged: boolean;
|
2023-05-10 09:43:28 +02:00
|
|
|
protected modeReturnArr: boolean;
|
2017-12-18 22:04:17 +01:00
|
|
|
|
|
|
|
constructor(port: number) {
|
|
|
|
super(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
public isUart() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public isAnalog() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-05-10 09:43:28 +02:00
|
|
|
public isModeReturnArr() {
|
|
|
|
return this.modeReturnArr;
|
2018-01-03 07:22:14 +01:00
|
|
|
}
|
|
|
|
|
2023-05-10 09:43:28 +02:00
|
|
|
public getValue() {
|
|
|
|
return 0;
|
2023-05-09 16:27:05 +02:00
|
|
|
}
|
|
|
|
|
2023-05-10 09:43:28 +02:00
|
|
|
public getValues() {
|
2023-05-09 16:27:05 +02:00
|
|
|
return [0];
|
|
|
|
}
|
|
|
|
|
|
|
|
setMode(mode: number) {
|
|
|
|
this.mode = mode;
|
|
|
|
this.changed = true;
|
|
|
|
this.modeChanged = true;
|
2023-05-10 09:43:28 +02:00
|
|
|
this.modeReturnArr = false;
|
2023-05-09 16:27:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
getMode() {
|
|
|
|
return this.mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
getDeviceType() {
|
|
|
|
return DAL.DEVICE_TYPE_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
public hasData() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
valueChange() {
|
|
|
|
const res = this.valueChanged;
|
|
|
|
this.valueChanged = false;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
modeChange() {
|
|
|
|
const res = this.modeChanged;
|
|
|
|
this.modeChanged = false;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
setChangedState() {
|
|
|
|
this.changed = true;
|
|
|
|
this.valueChanged = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-18 22:04:17 +01:00
|
|
|
export class AnalogSensorNode extends SensorNode {
|
|
|
|
|
|
|
|
constructor(port: number) {
|
|
|
|
super(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
public isUart() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public isAnalog() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export class UartSensorNode extends SensorNode {
|
|
|
|
|
|
|
|
constructor(port: number) {
|
|
|
|
super(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
hasChanged() {
|
|
|
|
return this.changed;
|
|
|
|
}
|
|
|
|
}
|
2023-05-09 16:27:05 +02:00
|
|
|
|
2017-12-18 22:04:17 +01:00
|
|
|
}
|