20 lines
598 B
C#
20 lines
598 B
C#
using System;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Text;
|
||
|
|
|
||
|
|
namespace CommonUsage.Protocols.VDA5050
|
||
|
|
{
|
||
|
|
public class CommunicationProtocolFactory
|
||
|
|
{
|
||
|
|
public static IVDACommunicationProtocol CreateProtocol(string protocolType, string host, int port)
|
||
|
|
{
|
||
|
|
return protocolType.ToLower() switch
|
||
|
|
{
|
||
|
|
"http" => new HTTPCommunication(host, port),
|
||
|
|
"mqtt" => new MQTTCommunication(host, port),
|
||
|
|
_ => throw new NotSupportedException($"Protocol {protocolType} is not supported")
|
||
|
|
};
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|