SafeDispatch/MotoTrbo_GW/RadioID2IP.cs

31 lines
785 B
C#
Raw Permalink Normal View History

2024-02-22 16:43:59 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MotoTrbo_GW
{
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;
//SafeMobileLib.Utils.WriteLine("IP-ul pentru group:"+m_ip);
}
public string GetIP()
{
return m_ip;
}
}
}