| 282 | } |
| 283 | |
| 284 | void Frontend::monitorSignal(const bool showStatus) { |
| 285 | #if SIMU |
| 286 | (void)showStatus; |
| 287 | _frontendData.setMonitorData(FE_HAS_LOCK, 214, 15, 0, 0); |
| 288 | #else |
| 289 | fe_status_t status; |
| 290 | |
| 291 | // first read status |
| 292 | if (::ioctl(_fd_fe, FE_READ_STATUS, &status) == 0) { |
| 293 | uint16_t strength = 0; |
| 294 | uint16_t snr = 0; |
| 295 | uint32_t ber = 0; |
| 296 | uint32_t ublocks = 0; |
| 297 | |
| 298 | # if FULL_DVB_API_VERSION >= 0x050A |
| 299 | if (!_oldApiCallStats) { |
| 300 | struct dtv_property p[3]; |
| 301 | int size = 0; |
| 302 | #define FILL_PROP(CMD, DATA) { p[size].cmd = CMD; p[size].u.data = DATA; ++size; } |
| 303 | |
| 304 | FILL_PROP(DTV_STAT_SIGNAL_STRENGTH, DTV_UNDEFINED); |
| 305 | FILL_PROP(DTV_STAT_CNR, DTV_UNDEFINED); |
| 306 | FILL_PROP(DTV_STAT_ERROR_BLOCK_COUNT, DTV_UNDEFINED); |
| 307 | |
| 308 | #undef FILL_PROP |
| 309 | |
| 310 | struct dtv_properties cmdseq; |
| 311 | cmdseq.num = size; |
| 312 | cmdseq.props = p; |
| 313 | |
| 314 | if (ioctl(_fd_fe, FE_GET_PROPERTY, &cmdseq) == -1) { |
| 315 | PERROR("FE_GET_PROPERTY failed"); |
| 316 | } |
| 317 | |
| 318 | const auto strengthScale = cmdseq.props[0].u.st.stat[0].scale; |
| 319 | switch (strengthScale) { |
| 320 | case FE_SCALE_DECIBEL: |
| 321 | strength = cmdseq.props[0].u.st.stat[0].svalue * 0.0001; |
| 322 | break; |
| 323 | case FE_SCALE_RELATIVE: |
| 324 | strength = cmdseq.props[0].u.st.stat[0].uvalue; |
| 325 | break; |
| 326 | case FE_SCALE_NOT_AVAILABLE: |
| 327 | default: |
| 328 | _oldApiCallStats = true; |
| 329 | break; |
| 330 | } |
| 331 | const auto cnrScale = cmdseq.props[1].u.st.stat[0].scale; |
| 332 | switch (cnrScale) { |
| 333 | case FE_SCALE_DECIBEL: |
| 334 | snr = cmdseq.props[1].u.st.stat[0].svalue * 0.0001; |
| 335 | break; |
| 336 | case FE_SCALE_RELATIVE: |
| 337 | snr = cmdseq.props[1].u.st.stat[0].uvalue; |
| 338 | break; |
| 339 | case FE_SCALE_NOT_AVAILABLE: |
| 340 | default: |
| 341 | _oldApiCallStats = true; |
no test coverage detected