• R/O
  • HTTP
  • SSH
  • HTTPS

rpi-dmonitor: Commit


Commit MetaInfo

Revisionf23b7ce6643abb5fe848be5caf6cf972b174b76b (tree)
Zeit2019-11-05 09:43:46
AutorSatoshi Yasuda <7m3tjz@jarl...>
CommiterSatoshi Yasuda

Log Message

modified: dmonitor.h
modified: inet_read.c
modified: init.h
modified: main.c

Ändern Zusammenfassung

Diff

--- a/dmonitor.h
+++ b/dmonitor.h
@@ -165,3 +165,5 @@ int jitter_wr_cnt;
165165 int jitter_wr_pnt;
166166
167167 char ptt;
168+
169+char hole_punch_msg_sw;
--- a/inet_read.c
+++ b/inet_read.c
@@ -1,9 +1,5 @@
11 #include "dmonitor.h"
22
3-extern unsigned char NullVoice[];
4-extern unsigned char null_data[];
5-
6-
73 int rig_status(void);
84 void header_store (char str[]);
95 void putFifo (int len, unsigned char pkt[]);
@@ -16,14 +12,6 @@ void jitter_putFifo(void);
1612 void rig_send_check(void);
1713
1814 unsigned char recvBuff[64];
19-char LastFrame0[3] = {0x55, 0x55, 0x55};
20-char LastFrame1[3] = {0x55, 0xc8, 0x7a};
21-char dummyRFheader[42] = {0x29, 0x20, 0x00, 0x00, 0x00,
22- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
23- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
24- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
25- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
26- 0x20, 0x20, 0x20, 0x20, 0xff};
2715
2816 char dummy_frame_1[12] = {
2917 0x73, 0x44, 0x1a, 0x72, 0x31, 0x3c, 0xa7, 0x53, 0x02, 0x55, 0x55, 0x55};
@@ -116,6 +104,11 @@ void inet_read(void)
116104 sprintf (buff, "%s", inet_ntoa (in_addr.sin_addr));
117105 sendto(in_addr_sock, buff, 24, 0,
118106 (struct sockaddr *)&in_addr, sizeof(in_addr));
107+ if (!hole_punch_msg_sw)
108+ {
109+ hole_punch_msg_sw = TRUE;
110+ syslog (LOG_INFO, "hole punch done.");
111+ }
119112 }
120113 return;
121114 }
@@ -200,9 +193,8 @@ void inet_read(void)
200193 if (recvBuff[16] == 0x00) inet_led_onoff();
201194 if (recvBuff[16] & 0x40)
202195 {
196+ memcpy (&recvBuff[17], dummy_frame_3, 12);
203197 memset (inet_frame_id, 0x00, 2);
204- memset (&recvBuff[26], 0x55, 3);
205- memcpy (&recvBuff[17], LastFrame1, 3);
206198 digitalWrite (INET_LED, 0);
207199 digitalWrite (RIG_LED, 0);
208200 rig_last_frame_send = TRUE;
@@ -229,14 +221,22 @@ void inet_read(void)
229221 #endif
230222 inet_read_cnt++;
231223 recvBuff[16] &= 0x1f;
232- memcpy (&recvBuff[17], NullVoice, 12);
224+ memcpy (&recvBuff[17], dummy_frame_1, 12);
233225 memset (&recvBuff[26], 0x55, 3);
234226 jitter_put (&recvBuff[16]);
235227 jitter_putFifo();
228+ if (recvBuff[16] % 2)
229+ {
230+ recvBuff[16]++;
231+ if (recvBuff[16] > 20) recvBuff[16] = 0x00;
232+ memcpy (&recvBuff[17], dummy_frame_2, 12);
233+ jitter_put (&recvBuff[16]);
234+ jitter_putFifo();
235+ }
236236 recvBuff[16]++;
237237 if (recvBuff[16] > 20) recvBuff[16] = 0x00;
238238 recvBuff[16] |= 0x40;
239- memcpy (&recvBuff[17], LastFrame1, 3);
239+ memcpy (&recvBuff[17], dummy_frame_3, 12);
240240 jitter_put (&recvBuff[16]);
241241 memset (inet_frame_id, 0x00, 2);
242242 inet_recv_time_save.tv_sec = inet_recv_time.tv_sec;
--- a/init.h
+++ b/init.h
@@ -1,9 +1,4 @@
1-//unsigned char lost_voice[9] = {0x9E, 0x8D, 0x32, 0x88, 0x26, 0x1A, 0x3F, 0x61, 0xE8};
21 unsigned char NullVoice[12] = {0x9e,0x8d,0x32,0x88,0x26,0x1a,0x3f,0x61,0xe8,0x55,0x2d,0x16};
32 unsigned char NullVoice1[12] = {0x9e,0x8d,0x32,0x88,0x26,0x1a,0x3f,0x61,0xe8,0xe7,0x84,0x76};
4-unsigned char null_data[3] = {0xe7, 0x84, 0x76};
5-unsigned char last_data0[3] = {0x55, 0x55, 0x55};
6-unsigned char last_data1[3] = {0x55, 0xc8, 0x7a};
7-unsigned char sync_id[3] = {0x55, 0x2d, 0x16};
83
94
--- a/main.c
+++ b/main.c
@@ -159,6 +159,7 @@ int main(int argc, char *argv[])
159159 jitter_buff_init();
160160
161161 ptt = 0x00;
162+ hole_punch_msg_sw = FALSE;
162163
163164 while (1)
164165 {
Show on old repository browser