|
|
|
@ -15,10 +15,24 @@ using UTIL; |
|
|
|
|
|
|
|
|
|
|
|
namespace UDPLIB |
|
|
|
namespace UDPLIB |
|
|
|
{ |
|
|
|
{ |
|
|
|
public class UDPreceive |
|
|
|
public class Data |
|
|
|
{ |
|
|
|
{ |
|
|
|
Int32 localPort = 5004; |
|
|
|
public static string Ver = "1.1.2.264"; |
|
|
|
Int32 remotePort = 5006; |
|
|
|
protected static string IPAddr = "192.168.1.2"; |
|
|
|
|
|
|
|
protected static Int32 LocalPort = 5004; |
|
|
|
|
|
|
|
protected static Int32 RemotePort = 5006; |
|
|
|
|
|
|
|
#if DEBUG |
|
|
|
|
|
|
|
public static string Conf = "Debug"; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
public static string Conf = "Release"; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public class UDPreceive : Data |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Int32 localPort = 5004; |
|
|
|
|
|
|
|
//Int32 remotePort = 5006; |
|
|
|
Thread UDPreceiveThread = null; |
|
|
|
Thread UDPreceiveThread = null; |
|
|
|
// Thread processFrameThread = null; |
|
|
|
// Thread processFrameThread = null; |
|
|
|
Thread sendFrameThread = null; |
|
|
|
Thread sendFrameThread = null; |
|
|
|
@ -30,11 +44,26 @@ namespace UDPLIB |
|
|
|
List<Byte[]> udata50 = new List<byte[]>(); |
|
|
|
List<Byte[]> udata50 = new List<byte[]>(); |
|
|
|
List<Byte[]> udata51 = new List<byte[]>(); |
|
|
|
List<Byte[]> udata51 = new List<byte[]>(); |
|
|
|
UInt32 cnt_frames = 0; |
|
|
|
UInt32 cnt_frames = 0; |
|
|
|
|
|
|
|
Res2 rrr2 = new Res2(); // класс ресурсов на замену Res |
|
|
|
|
|
|
|
|
|
|
|
#region Прием данных |
|
|
|
#region Прием данных |
|
|
|
public UDPreceive(Int32 localPortUDP) |
|
|
|
public UDPreceive(Int32 localPortUDP) |
|
|
|
{ |
|
|
|
{ |
|
|
|
localPort = localPortUDP; |
|
|
|
LocalPort = localPortUDP; |
|
|
|
|
|
|
|
for (int i = 0; i < 2500; i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
udata50.Add(new Byte[0]); |
|
|
|
|
|
|
|
udata51.Add(new Byte[0]); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fpstimer = new Stopwatch(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UDPreceiveThread = new Thread(new ThreadStart(UDPReceive7)); |
|
|
|
|
|
|
|
listening = true; |
|
|
|
|
|
|
|
UDPreceiveThread.Start(); |
|
|
|
|
|
|
|
cnt_frames = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public UDPreceive() |
|
|
|
|
|
|
|
{ |
|
|
|
for (int i = 0; i < 2500; i++) |
|
|
|
for (int i = 0; i < 2500; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
udata50.Add(new Byte[0]); |
|
|
|
udata50.Add(new Byte[0]); |
|
|
|
@ -70,13 +99,14 @@ namespace UDPLIB |
|
|
|
DialogResult res = DialogResult.OK; |
|
|
|
DialogResult res = DialogResult.OK; |
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
receiver = new UdpClient(localPort); |
|
|
|
// receiver = new UdpClient(localPort); |
|
|
|
endPoint = new IPEndPoint(IPAddress.Any, localPort); |
|
|
|
receiver = new UdpClient(LocalPort); |
|
|
|
|
|
|
|
endPoint = new IPEndPoint(IPAddress.Any, LocalPort); |
|
|
|
remoteIp = new IPEndPoint(IPAddress.Any, 0); |
|
|
|
remoteIp = new IPEndPoint(IPAddress.Any, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ee) |
|
|
|
catch (Exception ee) |
|
|
|
{ |
|
|
|
{ |
|
|
|
res = MessageBox.Show("Порт " + localPort.ToString() + " используется како-то программой. \r\n" + |
|
|
|
res = MessageBox.Show("Порт " + LocalPort.ToString() + " используется како-то программой. \r\n" + |
|
|
|
"Прием видео невозможен. Перезапустите программу.", "Ошибка!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
|
|
"Прием видео невозможен. Перезапустите программу.", "Ошибка!!!", MessageBoxButtons.OK, MessageBoxIcon.Error); |
|
|
|
System.Diagnostics.Process.GetCurrentProcess().Kill(); |
|
|
|
System.Diagnostics.Process.GetCurrentProcess().Kill(); |
|
|
|
return; |
|
|
|
return; |
|
|
|
@ -116,18 +146,55 @@ namespace UDPLIB |
|
|
|
} |
|
|
|
} |
|
|
|
if (numrow == 0 && ssrc == 12345678) // Packet 0 |
|
|
|
if (numrow == 0 && ssrc == 12345678) // Packet 0 |
|
|
|
{ |
|
|
|
{ |
|
|
|
iwidth = BitConverter.ToUInt16(data, 20); |
|
|
|
//iwidth = BitConverter.ToUInt16(data, 20); |
|
|
|
iheight = BitConverter.ToUInt16(data, 22); |
|
|
|
//iheight = BitConverter.ToUInt16(data, 22); |
|
|
|
|
|
|
|
|
|
|
|
blackline = new Byte[iwidth * 3 + 20]; |
|
|
|
blackline = new Byte[iwidth * 3 + 20]; |
|
|
|
|
|
|
|
|
|
|
|
Res.Iwidth = iwidth; |
|
|
|
RTP.DataH0 = data; |
|
|
|
Res.Iheight = iheight; |
|
|
|
RTP.GetDataH0(); |
|
|
|
Res.AzUpr = BitConverter.ToSingle(data, 24); |
|
|
|
|
|
|
|
Res.ElUpr = BitConverter.ToSingle(data, 28); |
|
|
|
//Res.Iwidth = iwidth; |
|
|
|
Res.Course = BitConverter.ToInt16(data, 32); |
|
|
|
//Res.Iheight = iheight; |
|
|
|
Res.Roll = BitConverter.ToInt16(data, 34); |
|
|
|
//Res.AzUpr = BitConverter.ToSingle(data, 24); |
|
|
|
Res.Pitch = BitConverter.ToInt16(data, 36); |
|
|
|
//Res.ElUpr = BitConverter.ToSingle(data, 28); |
|
|
|
|
|
|
|
//Res.Course = BitConverter.ToInt16(data, 32); |
|
|
|
|
|
|
|
//Res.Roll = BitConverter.ToInt16(data, 34); |
|
|
|
|
|
|
|
//Res.Pitch = BitConverter.ToInt16(data, 36); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
iwidth = RTP.SD_Width; |
|
|
|
|
|
|
|
iheight = RTP.SD_Height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Res.Iwidth = RTP.SD_Width; |
|
|
|
|
|
|
|
Res.Iheight = RTP.SD_Height; |
|
|
|
|
|
|
|
Res.AzUpr = RTP.SD_AzUpr; |
|
|
|
|
|
|
|
Res.ElUpr = RTP.SD_ElUpr; |
|
|
|
|
|
|
|
Res.Course = RTP.SD_Course; |
|
|
|
|
|
|
|
Res.Roll = RTP.SD_Roll; |
|
|
|
|
|
|
|
Res.Pitch = RTP.SD_Pitch; |
|
|
|
|
|
|
|
Res.Shirota = RTP.SD_Shirota; |
|
|
|
|
|
|
|
Res.Dolgota = RTP.SD_Dolgota; |
|
|
|
|
|
|
|
Res.Vysota = RTP.SD_Vysota; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Res.rejim_oes = RTP.SD_rejim_oes; |
|
|
|
|
|
|
|
Res.zahvat = RTP.SD_zahvat; |
|
|
|
|
|
|
|
Res.color = RTP.SD_color; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rrr2.Iwidth = RTP.SD_Width; |
|
|
|
|
|
|
|
rrr2.Iheight = RTP.SD_Height; |
|
|
|
|
|
|
|
rrr2.AzUpr = RTP.SD_AzUpr; |
|
|
|
|
|
|
|
rrr2.ElUpr = RTP.SD_ElUpr; |
|
|
|
|
|
|
|
rrr2.Course = RTP.SD_Course; |
|
|
|
|
|
|
|
rrr2.Roll = RTP.SD_Roll; |
|
|
|
|
|
|
|
rrr2.Pitch = RTP.SD_Pitch; |
|
|
|
|
|
|
|
rrr2.Shirota = RTP.SD_Shirota; |
|
|
|
|
|
|
|
rrr2.Dolgota = RTP.SD_Dolgota; |
|
|
|
|
|
|
|
rrr2.Vysota = RTP.SD_Vysota; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rrr2.rejim_oes = RTP.SD_rejim_oes; |
|
|
|
|
|
|
|
rrr2.zahvat = RTP.SD_zahvat; |
|
|
|
|
|
|
|
rrr2.color = RTP.SD_color; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (data[1] == 0xC7 && iheight != 0 && iwidth != 0) |
|
|
|
if (data[1] == 0xC7 && iheight != 0 && iwidth != 0) |
|
|
|
@ -227,14 +294,19 @@ namespace UDPLIB |
|
|
|
Res.Clearimg = (Bitmap)img.Clone(); |
|
|
|
Res.Clearimg = (Bitmap)img.Clone(); |
|
|
|
Res.Bmp = img; |
|
|
|
Res.Bmp = img; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rrr2.Clearimg = (Bitmap)img.Clone(); |
|
|
|
|
|
|
|
rrr2.Bmp = img; |
|
|
|
|
|
|
|
|
|
|
|
fpstimer.Stop(); |
|
|
|
fpstimer.Stop(); |
|
|
|
// Res.Fps = gk.filtered(1000F / fpstimer.ElapsedMilliseconds); |
|
|
|
// Res.Fps = gk.filtered(1000F / fpstimer.ElapsedMilliseconds); |
|
|
|
Res.Fps = 1000F / fpstimer.ElapsedMilliseconds; |
|
|
|
Res.Fps = 1000F / fpstimer.ElapsedMilliseconds; |
|
|
|
Res.Frames = cnt_frames++; |
|
|
|
Res.Frames = cnt_frames++; |
|
|
|
|
|
|
|
rrr2.Fps = 1000F / fpstimer.ElapsedMilliseconds; |
|
|
|
|
|
|
|
rrr2.Frames = cnt_frames++; |
|
|
|
// Res.Fps = 1000F / fpstimer.ElapsedMilliseconds; |
|
|
|
// Res.Fps = 1000F / fpstimer.ElapsedMilliseconds; |
|
|
|
fpstimer.Reset(); |
|
|
|
fpstimer.Reset(); |
|
|
|
fpstimer.Start(); |
|
|
|
fpstimer.Start(); |
|
|
|
CallBack.Event_newimg_Handler(); |
|
|
|
CallBack.Event_newimg_Handler2(rrr2); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -247,7 +319,7 @@ namespace UDPLIB |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class UDPTransmit |
|
|
|
public class UDPTransmit : Data |
|
|
|
{ |
|
|
|
{ |
|
|
|
UdpClient transmitter = null; |
|
|
|
UdpClient transmitter = null; |
|
|
|
IPEndPoint endPoint = null; |
|
|
|
IPEndPoint endPoint = null; |
|
|
|
@ -283,6 +355,20 @@ namespace UDPLIB |
|
|
|
Thread UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
Thread UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public UDPTransmit((UInt16, UInt16, UInt16, UInt16) p) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
transmitter = new UdpClient(); |
|
|
|
|
|
|
|
endPoint = new IPEndPoint(IPAddress.Parse(IPAddr), RemotePort); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pntX = p.Item1; // X координата |
|
|
|
|
|
|
|
pntY = p.Item2; // Y координата |
|
|
|
|
|
|
|
pntlx = p.Item3; // ширина эталона |
|
|
|
|
|
|
|
pntly = p.Item4; // высота эталона |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Res.Crop = Res.Clearimg.Clone(new Rectangle(pntX - pntlx / 2, pntY - pntly / 2, pntlx, pntly), PixelFormat.Format24bppRgb); |
|
|
|
|
|
|
|
Thread UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
|
|
|
|
UDPtransmitThread.Start(); |
|
|
|
|
|
|
|
} |
|
|
|
public UDPTransmit(String IPaddr, Int32 remotePortUDP, Bitmap crop) |
|
|
|
public UDPTransmit(String IPaddr, Int32 remotePortUDP, Bitmap crop) |
|
|
|
{ |
|
|
|
{ |
|
|
|
transmitter = new UdpClient(); |
|
|
|
transmitter = new UdpClient(); |
|
|
|
@ -319,7 +405,6 @@ namespace UDPLIB |
|
|
|
RTPet.SD_Course = RTP.SD_Course; |
|
|
|
RTPet.SD_Course = RTP.SD_Course; |
|
|
|
RTPet.SD_Roll = RTP.SD_Roll; |
|
|
|
RTPet.SD_Roll = RTP.SD_Roll; |
|
|
|
RTPet.SD_Pitch = RTP.SD_Pitch; |
|
|
|
RTPet.SD_Pitch = RTP.SD_Pitch; |
|
|
|
RTPet.SD_FrameId = 0; |
|
|
|
|
|
|
|
RTPet.SD_X = pntX; |
|
|
|
RTPet.SD_X = pntX; |
|
|
|
RTPet.SD_Y = pntY; |
|
|
|
RTPet.SD_Y = pntY; |
|
|
|
RTPet.SD_lx = (Byte)pntlx; |
|
|
|
RTPet.SD_lx = (Byte)pntlx; |
|
|
|
@ -378,7 +463,7 @@ namespace UDPLIB |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class UDPTransmitSim |
|
|
|
public class UDPTransmitSim : Data |
|
|
|
{ |
|
|
|
{ |
|
|
|
UdpClient transmitter = null; |
|
|
|
UdpClient transmitter = null; |
|
|
|
IPEndPoint endPoint = null; |
|
|
|
IPEndPoint endPoint = null; |
|
|
|
@ -388,19 +473,40 @@ namespace UDPLIB |
|
|
|
Int32 delayMS = 0; |
|
|
|
Int32 delayMS = 0; |
|
|
|
public Bitmap img = null; // Resources.che1; |
|
|
|
public Bitmap img = null; // Resources.che1; |
|
|
|
volatile Boolean flag = false; |
|
|
|
volatile Boolean flag = false; |
|
|
|
|
|
|
|
Thread UDPtransmitThread = null; |
|
|
|
|
|
|
|
Stopwatch fpstmr; |
|
|
|
|
|
|
|
private UInt32 cnt_frame = 0; |
|
|
|
|
|
|
|
float fps = 0; |
|
|
|
|
|
|
|
|
|
|
|
public UDPTransmitSim(String IPaddr, Int32 remotePortUDP, Int32 sizeX, Int32 sizeY, Int32 delayMS) |
|
|
|
public UDPTransmitSim(String ipaddr, Int32 remotePortUDP, Int32 sizeX, Int32 sizeY, Int32 delayMS) |
|
|
|
{ |
|
|
|
{ |
|
|
|
transmitter = new UdpClient(); |
|
|
|
transmitter = new UdpClient(); |
|
|
|
endPoint = new IPEndPoint(IPAddress.Parse(IPaddr), remotePortUDP); |
|
|
|
endPoint = new IPEndPoint(IPAddress.Parse(ipaddr), remotePortUDP); |
|
|
|
this.sizeX = sizeX; |
|
|
|
this.sizeX = sizeX; |
|
|
|
this.sizeY = sizeY; |
|
|
|
this.sizeY = sizeY; |
|
|
|
this.delayMS = delayMS; |
|
|
|
this.delayMS = delayMS; |
|
|
|
|
|
|
|
|
|
|
|
img = new Bitmap(Res.Sim, new Size(sizeX, sizeY)); |
|
|
|
img = new Bitmap(Res.Sim, new Size(sizeX, sizeY)); |
|
|
|
|
|
|
|
|
|
|
|
Thread UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
|
|
|
|
UDPtransmitThread.Start(); |
|
|
|
|
|
|
|
Start(); |
|
|
|
|
|
|
|
fpstmr = new Stopwatch(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public UDPTransmitSim(Int32 sizeX, Int32 sizeY, Int32 delayMS) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
transmitter = new UdpClient(); |
|
|
|
|
|
|
|
endPoint = new IPEndPoint(IPAddress.Parse(IPAddr), RemotePort); |
|
|
|
|
|
|
|
this.sizeX = sizeX; |
|
|
|
|
|
|
|
this.sizeY = sizeY; |
|
|
|
|
|
|
|
this.delayMS = delayMS; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
img = new Bitmap(Res.Sim, new Size(sizeX, sizeY)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
|
|
|
|
Start(); |
|
|
|
|
|
|
|
fpstmr = new Stopwatch(); |
|
|
|
} |
|
|
|
} |
|
|
|
public UDPTransmitSim(String IPaddr, Int32 remotePortUDP, Int32 delayMS, Bitmap i) |
|
|
|
public UDPTransmitSim(String IPaddr, Int32 remotePortUDP, Int32 delayMS, Bitmap i) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -410,10 +516,12 @@ namespace UDPLIB |
|
|
|
sizeY = i.Height; |
|
|
|
sizeY = i.Height; |
|
|
|
this.delayMS = delayMS; |
|
|
|
this.delayMS = delayMS; |
|
|
|
|
|
|
|
|
|
|
|
img = i; |
|
|
|
img = new Bitmap(i); |
|
|
|
|
|
|
|
|
|
|
|
Thread UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
UDPtransmitThread = new Thread(new ThreadStart(UDPtransmitFrame)); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
UDPtransmitThread.Start(); |
|
|
|
|
|
|
|
Start(); |
|
|
|
|
|
|
|
fpstmr = new Stopwatch(); |
|
|
|
} |
|
|
|
} |
|
|
|
public void Start() |
|
|
|
public void Start() |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -421,13 +529,17 @@ namespace UDPLIB |
|
|
|
} |
|
|
|
} |
|
|
|
public void Stop() |
|
|
|
public void Stop() |
|
|
|
{ |
|
|
|
{ |
|
|
|
flag &= false; |
|
|
|
flag = false; |
|
|
|
} |
|
|
|
} |
|
|
|
void UDPtransmitFrame() |
|
|
|
void UDPtransmitFrame() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
transmitter.Connect(endPoint); |
|
|
|
|
|
|
|
Res.Frames = 0; |
|
|
|
|
|
|
|
//cnt_frame = 0; |
|
|
|
|
|
|
|
|
|
|
|
while (flag) |
|
|
|
while (flag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
transmitter.Connect(endPoint); |
|
|
|
fpstmr.Start(); |
|
|
|
// RTPMsgHeader |
|
|
|
// RTPMsgHeader |
|
|
|
RTP.MH_VerPXCC = 2; |
|
|
|
RTP.MH_VerPXCC = 2; |
|
|
|
RTP.MH_MPT = 0xC6; |
|
|
|
RTP.MH_MPT = 0xC6; |
|
|
|
@ -452,8 +564,6 @@ namespace UDPLIB |
|
|
|
RTP.SD_rejim_oes = 2; |
|
|
|
RTP.SD_rejim_oes = 2; |
|
|
|
RTP.SD_color = 1; |
|
|
|
RTP.SD_color = 1; |
|
|
|
|
|
|
|
|
|
|
|
RTP.SD_FrameId = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RTP.MakeDataH0(); |
|
|
|
RTP.MakeDataH0(); |
|
|
|
transmitter.Send(RTP.DataH0, RTP.DataH0.Length); |
|
|
|
transmitter.Send(RTP.DataH0, RTP.DataH0.Length); |
|
|
|
|
|
|
|
|
|
|
|
@ -484,9 +594,9 @@ namespace UDPLIB |
|
|
|
for (int j = 0; j < sizeX; j++) |
|
|
|
for (int j = 0; j < sizeX; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Color c = img.GetPixel(j, i); |
|
|
|
Color c = img.GetPixel(j, i); |
|
|
|
dataimg[ccc++] = c.B; |
|
|
|
|
|
|
|
dataimg[ccc++] = c.G; |
|
|
|
|
|
|
|
dataimg[ccc++] = c.R; |
|
|
|
dataimg[ccc++] = c.R; |
|
|
|
|
|
|
|
dataimg[ccc++] = c.G; |
|
|
|
|
|
|
|
dataimg[ccc++] = c.B; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ee) |
|
|
|
catch (Exception ee) |
|
|
|
@ -499,10 +609,32 @@ namespace UDPLIB |
|
|
|
Array.Copy(dataimg, 0, dataudp, RTP.DataH1.Length, dataimg.Length); |
|
|
|
Array.Copy(dataimg, 0, dataudp, RTP.DataH1.Length, dataimg.Length); |
|
|
|
transmitter.Send(dataudp, dataudp.Length); |
|
|
|
transmitter.Send(dataudp, dataudp.Length); |
|
|
|
} |
|
|
|
} |
|
|
|
transmitter.Close(); |
|
|
|
Res.Frames++; |
|
|
|
|
|
|
|
// transmitter.Close(); |
|
|
|
|
|
|
|
fpstmr.Stop(); |
|
|
|
|
|
|
|
fps = 1000F / fpstmr.ElapsedMilliseconds; |
|
|
|
|
|
|
|
Res.Fps = fps; |
|
|
|
|
|
|
|
fpstmr.Reset(); |
|
|
|
|
|
|
|
cnt_frame++; |
|
|
|
|
|
|
|
CallBack.Event_transmitted_Handler(); |
|
|
|
Thread.Sleep(delayMS); |
|
|
|
Thread.Sleep(delayMS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Res.Frames = 0; |
|
|
|
|
|
|
|
Res.Fps = 0; |
|
|
|
|
|
|
|
CallBack.Event_transmitted_Handler(); |
|
|
|
|
|
|
|
transmitter.Close(); |
|
|
|
|
|
|
|
transmitter.Dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (img != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
UDPtransmitThread.Abort(); |
|
|
|
|
|
|
|
img.Dispose(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
flag = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class thrdata |
|
|
|
class thrdata |
|
|
|
@ -542,27 +674,13 @@ namespace UDPLIB |
|
|
|
public static Byte rejim_oes { set; get; } // Режим ОЭС: «0» – Обзор, «1» – АС |
|
|
|
public static Byte rejim_oes { set; get; } // Режим ОЭС: «0» – Обзор, «1» – АС |
|
|
|
public static Byte zahvat { set; get; } // Захват: «0» – отсутствие захвата, «1» – налачие захвата |
|
|
|
public static Byte zahvat { set; get; } // Захват: «0» – отсутствие захвата, «1» – налачие захвата |
|
|
|
public static Byte color { set; get; } // Цвет изображения: «1» – цветное, «0» – монохромное |
|
|
|
public static Byte color { set; get; } // Цвет изображения: «1» – цветное, «0» – монохромное |
|
|
|
public static String Version |
|
|
|
public static String Version { get => Data.Ver; } |
|
|
|
{ |
|
|
|
public static String Configuration { get => Data.Conf; } |
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return "1.1.0.255"; |
|
|
|
|
|
|
|
// return Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static String Configuration |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if DEBUG |
|
|
|
|
|
|
|
return "Debug"; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return "Release"; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public static Boolean status_rs { set; get; } |
|
|
|
public static Boolean status_rs { set; get; } |
|
|
|
public static Boolean status_eth { set; get; } |
|
|
|
public static Boolean status_eth { set; get; } |
|
|
|
|
|
|
|
public static float Az { set; get; } |
|
|
|
|
|
|
|
public static float El { set; get; } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
public class Res2 |
|
|
|
public class Res2 |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -588,24 +706,8 @@ namespace UDPLIB |
|
|
|
public Byte rejim_oes; // Режим ОЭС: «0» – Обзор, «1» – АС |
|
|
|
public Byte rejim_oes; // Режим ОЭС: «0» – Обзор, «1» – АС |
|
|
|
public Byte zahvat; // Захват: «0» – отсутствие захвата, «1» – налачие захвата |
|
|
|
public Byte zahvat; // Захват: «0» – отсутствие захвата, «1» – налачие захвата |
|
|
|
public Byte color; // Цвет изображения: «1» – цветное, «0» – монохромное |
|
|
|
public Byte color; // Цвет изображения: «1» – цветное, «0» – монохромное |
|
|
|
public String Version |
|
|
|
public String Version { get => Data.Ver; } |
|
|
|
{ |
|
|
|
public String Configuration { get => Data.Conf; } |
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return "1.1.0.255"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public String Configuration |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if DEBUG |
|
|
|
|
|
|
|
return "Debug"; |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
return "Release"; |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public Boolean status_rs { set; get; } |
|
|
|
public Boolean status_rs { set; get; } |
|
|
|
public Boolean status_eth { set; get; } |
|
|
|
public Boolean status_eth { set; get; } |
|
|
|
} |
|
|
|
} |
|
|
|
|