SafeNet/SafeNetLib/RadioID2IP.cs
2021-02-24 13:50:23 +02:00

31 lines
699 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace SafeNetLib
{
public class RadioID2IP
{
string m_ip;
public RadioID2IP(string p_CAI, string p_radioIP)
{
uint radioID = Convert.ToUInt32(p_radioIP);
if (radioID > 255 * 255 * 255)
throw new Exception("Radio ID out of range");
byte c = (byte)(radioID & 0x0000FF);
byte b = (byte)((radioID & 0x00FF00) >> 8);
byte a = (byte)((radioID & 0xFF0000) >> 16);
m_ip = "" + p_CAI + "." + a + "." + b + "." + c;
}
public string GetIP()
{
return m_ip;
}
}
}