added function so the component can display its port and cable id
This commit is contained in:
parent
898bb9e0f1
commit
a4b6179b26
1 changed files with 30 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ import { quack } from "protobuf-ts/pond";
|
||||||
import { or } from "utils/types";
|
import { or } from "utils/types";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { getSubtypes } from "pbHelpers/ComponentType";
|
import { getSubtypes } from "pbHelpers/ComponentType";
|
||||||
|
import { getFriendlyAddressTypeName, getHumanReadableAddress } from "pbHelpers/AddressType";
|
||||||
// import { getSubtypes } from "pbHelpers/ComponentType";
|
// import { getSubtypes } from "pbHelpers/ComponentType";
|
||||||
|
|
||||||
export class Component {
|
export class Component {
|
||||||
|
|
@ -105,4 +106,33 @@ export class Component {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addressDescription = (deviceProduct?: pond.DeviceProduct) => {
|
||||||
|
if (
|
||||||
|
this.settings.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY ||
|
||||||
|
(this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
|
||||||
|
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100)
|
||||||
|
) {
|
||||||
|
let addressDescription = getHumanReadableAddress(
|
||||||
|
this.settings.addressType,
|
||||||
|
this.settings.type,
|
||||||
|
this.settings.address,
|
||||||
|
deviceProduct
|
||||||
|
);
|
||||||
|
if (addressDescription === "") {
|
||||||
|
addressDescription = "Internal";
|
||||||
|
}
|
||||||
|
let port = "Port: " + addressDescription;
|
||||||
|
let cableID = "";
|
||||||
|
if (
|
||||||
|
this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
|
||||||
|
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100
|
||||||
|
) {
|
||||||
|
cableID = "Cable: " + (this.settings.addressType - 8);
|
||||||
|
}
|
||||||
|
return port + " " + cableID;
|
||||||
|
} else {
|
||||||
|
return getFriendlyAddressTypeName(this.settings.addressType);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue