1/*
2 *    Copyright (C) 2017 - 2021
3 *    Albrecht Lohofener (albrechtloh@gmx.de)
4 *
5 *    This file is part of the welle.io.
6 *    Many of the ideas as implemented in welle.io are derived from
7 *    other work, made available through the GNU general Public License.
8 *    All copyrights of the original authors are recognized.
9 *
10 *    welle.io is free software; you can redistribute it and/or modify
11 *    it under the terms of the GNU General Public License as published by
12 *    the Free Software Foundation; either version 2 of the License, or
13 *    (at your option) any later version.
14 *
15 *    welle.io is distributed in the hope that it will be useful,
16 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *    GNU General Public License for more details.
19 *
20 *    You should have received a copy of the GNU General Public License
21 *    along with welle.io; if not, write to the Free Software
22 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23 *
24 */
25
26import QtQuick 2.2
27import QtQuick.Layouts 1.1
28
29// Import custom styles
30import "../texts"
31import "../components"
32
33
34ViewBaseFrame {
35    labelText: qsTr("Service Details")
36
37    content: ColumnLayout {
38        anchors.fill: parent
39        Layout.margins: Units.dp(50)
40
41        TextExpert {
42            name: qsTr("Device") + ":"
43            text: radioController.deviceName
44        }
45
46        TextExpert {
47            name: qsTr("Current channel") + ":"
48            text: radioController.channel + " (" + (radioController.frequency > 0 ? radioController.frequency/1e6 :  "N/A") + " MHz)"
49        }
50
51        TextExpert {
52            name: qsTr("Frequency correction") + ":"
53            text: radioController.frequencyCorrection + " Hz (" + (radioController.frequency > 0 ? radioController.frequencyCorrectionPpm.toFixed(2) : "N/A") + " ppm)"
54        }
55
56        TextExpert {
57            name: qsTr("SNR") + ":"
58            text: radioController.snr.toFixed(2) + " dB"
59        }
60
61        RowLayout {
62            Rectangle{
63                height: Units.dp(16)
64                width: Units.dp(16)
65                color: radioController.isSync ? "green" : "red"
66            }
67
68            TextExpert {
69                name: qsTr("Frame sync")  + ":"
70                text: radioController.isSync ? qsTr("OK") : qsTr("Not synced")
71            }
72
73        }
74
75        RowLayout {
76            Rectangle{
77                height: Units.dp(16)
78                width: Units.dp(16)
79                color: radioController.isFICCRC ? "green" : "red"
80            }
81
82            TextExpert {
83                name: qsTr("FIC CRC")  + ":"
84                text: radioController.isFICCRC ? qsTr("OK") : qsTr("Error")
85            }
86        }
87
88        RowLayout {
89            Rectangle{
90                height: Units.dp(16)
91                width: Units.dp(16)
92                color: (radioController.frameErrors === 0
93                        && radioController.isSync
94                        && radioController.isFICCRC) ? "green" : "red"
95            }
96
97            TextExpert {
98                name: qsTr("Frame errors")  + ":"
99                text: radioController.frameErrors
100            }
101        }
102
103        RowLayout {
104            Rectangle{
105                height: Units.dp(16)
106                width: Units.dp(16)
107                color: (radioController.rsCorrectedErrors === 0
108                        && radioController.rsUncorrectedErrors === 0)
109                        ? "green" : (radioController.rsCorrectedErrors >= 0
110                                     && radioController.rsUncorrectedErrors === 0) ? "yellow" : "red"
111            }
112
113            TextExpert {
114                name: qsTr("RS errors")  + ":"
115                text: (radioController.rsCorrectedErrors === 0
116                       && radioController.rsUncorrectedErrors === 0)
117                       ? qsTr("OK") : (radioController.rsCorrectedErrors >= 0
118                                    && radioController.rsUncorrectedErrors === 0) ? qsTr("Corrected Error") : qsTr("Uncorrected Error")
119            }
120        }
121
122        RowLayout {
123            Rectangle{
124                height: Units.dp(16)
125                width: Units.dp(16)
126                color: radioController.aacErrors === 0 ? "green" : "red"
127            }
128
129            TextExpert {
130                name: qsTr("AAC errors")  + ":"
131                text: radioController.aacErrors
132            }
133        }
134
135        TextExpert {
136            name: qsTr("DAB date and time") + ":"
137            text: radioController.dateTime.toUTCString()
138        }
139    }
140}
141