forked from g0orx/linhpsdr
-
Notifications
You must be signed in to change notification settings - Fork 7
/
about_dialog.c
161 lines (141 loc) · 5.08 KB
/
about_dialog.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* Copyright (C)
* 2017 - John Melton, G0ORX/N6LYT
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <gtk/gtk.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <wdsp.h>
#ifdef SOAPYSDR
#include <SoapySDR/Device.h>
#endif
#include "discovered.h"
#include "bpsk.h"
#include "receiver.h"
#include "transmitter.h"
#include "receiver.h"
#include "wideband.h"
#include "adc.h"
#include "dac.h"
#include "radio.h"
#include "version.h"
#include "about_dialog.h"
static GtkWidget *label;
GtkWidget *create_about_dialog(RADIO *r) {
char text[2048];
char addr[64];
char interface_addr[64];
char protocol[32];
GtkWidget *grid=gtk_grid_new();
gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
gtk_grid_set_column_spacing (GTK_GRID(grid),4);
int row=0;
snprintf(text,sizeof(text),"linHPSDR by John Melton G0ORX/N6LYT");
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text),"With help from:");
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text)," Steve Wilson, KA6S, RIGCTL (CAT over TCP) and Testing");
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text)," Ken Hopper, N9VV, Testing and Documentation");
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text),"Build date: %s", build_date);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text),"Build version: %s", version);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text),"WDSP v%d.%02d", GetWDSPVersion()/100, GetWDSPVersion()%100);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
switch(r->discovered->protocol) {
case PROTOCOL_1:
snprintf(protocol,sizeof(protocol),"Protocol: 1");
break;
case PROTOCOL_2:
snprintf(protocol,sizeof(protocol),"Protocol: 2");
break;
#ifdef SOAPYSDR
case PROTOCOL_SOAPYSDR:
snprintf(protocol,sizeof(protocol),"Protocol: SOAPYSDR");
break;
#endif
}
snprintf(text,sizeof(text),"Device: %s %s %s",r->discovered->name,protocol,r->discovered->software_version);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
switch(r->discovered->protocol) {
case PROTOCOL_1:
case PROTOCOL_2:
#ifdef USBOZY
if(d->device==DEVICE_OZY) {
snprintf(text,sizeof(text),"Device OZY: USB /dev/ozy");
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
} else {
#endif
strcpy(addr,inet_ntoa(r->discovered->info.network.address.sin_addr));
strcpy(interface_addr,inet_ntoa(r->discovered->info.network.interface_address.sin_addr));
snprintf(text,sizeof(text),"Device Mac Address: %02X:%02X:%02X:%02X:%02X:%02X",
r->discovered->info.network.mac_address[0],
r->discovered->info.network.mac_address[1],
r->discovered->info.network.mac_address[2],
r->discovered->info.network.mac_address[3],
r->discovered->info.network.mac_address[4],
r->discovered->info.network.mac_address[5]);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
snprintf(text,sizeof(text),"Device IP Address: %s on %s (%s)",addr,r->discovered->info.network.interface_name,interface_addr);
label=gtk_label_new(text);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_LEFT);
gtk_grid_attach(GTK_GRID(grid),label,1,row,1,1);
row++;
#ifdef USBOZY
}
#endif
break;
}
return grid;
}