diff --git a/src/inet/common/Cable.cc b/src/inet/common/Cable.cc new file mode 100644 index 00000000000..0b92713a958 --- /dev/null +++ b/src/inet/common/Cable.cc @@ -0,0 +1,26 @@ +// +// Copyright (C) 2013 OpenSim Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +// + +#include "inet/common/Cable.h" + +namespace inet { + +Define_Channel(Cable); + +void Cable::initialize() +{ + cDatarateChannel::initialize(); + enabledLineStyle = par("enabledLineStyle"); + disabledLineStyle = par("disabledLineStyle"); +} + +void Cable::refreshDisplay() const +{ + cDatarateChannel::refreshDisplay(); + getDisplayString().setTagArg("ls", 2, isDisabled() ? disabledLineStyle : enabledLineStyle); +} + +} // namespace inet diff --git a/src/inet/common/Cable.h b/src/inet/common/Cable.h new file mode 100644 index 00000000000..395152fe390 --- /dev/null +++ b/src/inet/common/Cable.h @@ -0,0 +1,28 @@ +// +// Copyright (C) 2013 OpenSim Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +// + + +#ifndef __INET_CABLE_H +#define __INET_CABLE_H + +#include "inet/common/INETDefs.h" + +namespace inet { + +class INET_API Cable : public cDatarateChannel +{ + protected: + const char *enabledLineStyle = nullptr; + const char *disabledLineStyle = nullptr; + + protected: + virtual void initialize() override; + virtual void refreshDisplay() const override; +}; + +} // namespace inet + +#endif diff --git a/src/inet/common/Cable.ned b/src/inet/common/Cable.ned new file mode 100644 index 00000000000..ee49b90a66d --- /dev/null +++ b/src/inet/common/Cable.ned @@ -0,0 +1,18 @@ +// +// Copyright (C) 2020 OpenSim Ltd. +// +// SPDX-License-Identifier: LGPL-3.0-or-later +// + + +package inet.common; + +import ned.DatarateChannel; + +channel Cable extends DatarateChannel +{ + parameters: + string enabledLineStyle = default("solid"); + string disabledLineStyle = default("dashed"); + @class(Cable); +}