marklin_can: added Network to TCP/UDP interface types
More CAN interface options can be added in the future, e.g. SocketCAN see #11
Dieser Commit ist enthalten in:
Ursprung
779b8f3fb4
Commit
b773187c9b
@ -40,7 +40,7 @@ MarklinCANInterface::MarklinCANInterface(World& world, std::string_view _id)
|
|||||||
: Interface(world, _id)
|
: Interface(world, _id)
|
||||||
, DecoderController(*this, decoderListColumns)
|
, DecoderController(*this, decoderListColumns)
|
||||||
, InputController(static_cast<IdObject&>(*this))
|
, InputController(static_cast<IdObject&>(*this))
|
||||||
, type{this, "type", MarklinCANInterfaceType::TCP, PropertyFlags::ReadWrite | PropertyFlags::Store}
|
, type{this, "type", MarklinCANInterfaceType::NetworkTCP, PropertyFlags::ReadWrite | PropertyFlags::Store}
|
||||||
, hostname{this, "hostname", "", PropertyFlags::ReadWrite | PropertyFlags::Store}
|
, hostname{this, "hostname", "", PropertyFlags::ReadWrite | PropertyFlags::Store}
|
||||||
{
|
{
|
||||||
name = "M\u00E4rklin CAN";
|
name = "M\u00E4rklin CAN";
|
||||||
@ -106,11 +106,11 @@ bool MarklinCANInterface::setOnline(bool& value, bool simulation)
|
|||||||
{
|
{
|
||||||
switch(type.value())
|
switch(type.value())
|
||||||
{
|
{
|
||||||
case MarklinCANInterfaceType::TCP:
|
case MarklinCANInterfaceType::NetworkTCP:
|
||||||
m_kernel = MarklinCAN::Kernel::create<MarklinCAN::TCPIOHandler>(config, hostname.value());
|
m_kernel = MarklinCAN::Kernel::create<MarklinCAN::TCPIOHandler>(config, hostname.value());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MarklinCANInterfaceType::UDP:
|
case MarklinCANInterfaceType::NetworkUDP:
|
||||||
m_kernel = MarklinCAN::Kernel::create<MarklinCAN::UDPIOHandler>(config, hostname.value());
|
m_kernel = MarklinCAN::Kernel::create<MarklinCAN::UDPIOHandler>(config, hostname.value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,19 +29,19 @@
|
|||||||
|
|
||||||
enum class MarklinCANInterfaceType : uint16_t
|
enum class MarklinCANInterfaceType : uint16_t
|
||||||
{
|
{
|
||||||
TCP = 0,
|
NetworkTCP = 0,
|
||||||
UDP = 1,
|
NetworkUDP = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
TRAINTASTIC_ENUM(MarklinCANInterfaceType, "marklin_can_interface_type", 2,
|
TRAINTASTIC_ENUM(MarklinCANInterfaceType, "marklin_can_interface_type", 2,
|
||||||
{
|
{
|
||||||
{MarklinCANInterfaceType::TCP, "tcp"},
|
{MarklinCANInterfaceType::NetworkTCP, "network_tcp"},
|
||||||
{MarklinCANInterfaceType::UDP, "udp"},
|
{MarklinCANInterfaceType::NetworkUDP, "network_udp"},
|
||||||
});
|
});
|
||||||
|
|
||||||
inline constexpr std::array<MarklinCANInterfaceType, 2> marklinCANInterfaceTypeValues{{
|
inline constexpr std::array<MarklinCANInterfaceType, 2> marklinCANInterfaceTypeValues{{
|
||||||
MarklinCANInterfaceType::TCP,
|
MarklinCANInterfaceType::NetworkTCP,
|
||||||
MarklinCANInterfaceType::UDP,
|
MarklinCANInterfaceType::NetworkUDP,
|
||||||
}};
|
}};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -4222,5 +4222,13 @@
|
|||||||
"term_plural": "",
|
"term_plural": "",
|
||||||
"reference": "",
|
"reference": "",
|
||||||
"comment": ""
|
"comment": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"term": "marklin_can_interface_type:network_tcp",
|
||||||
|
"definition": "Network (TCP)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"term": "marklin_can_interface_type:network_udp",
|
||||||
|
"definition": "Network (UDP)"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -358,13 +358,5 @@
|
|||||||
{
|
{
|
||||||
"term": "decoder_protocol:selectrix",
|
"term": "decoder_protocol:selectrix",
|
||||||
"definition": "Selectrix"
|
"definition": "Selectrix"
|
||||||
},
|
|
||||||
{
|
|
||||||
"term": "marklin_can_interface_type:tcp",
|
|
||||||
"definition": "TCP"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"term": "marklin_can_interface_type:udp",
|
|
||||||
"definition": "UDP"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren