source: ntrip/trunk/BNC/upload/bncephuploadcaster.cpp@ 4063

Last change on this file since 4063 was 3582, checked in by mervart, 13 years ago
File size: 2.2 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Server
3 * -------------------------------------------------------------------------
4 *
5 * Class: bncEphUploadCaster
6 *
7 * Purpose: Connection to NTRIP Caster for Ephemeris
8 *
9 * Author: L. Mervart
10 *
11 * Created: 03-Apr-2011
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <iostream>
18#include <math.h>
19#include "bncephuploadcaster.h"
20#include "bncsettings.h"
21
22using namespace std;
23
24// Constructor
25////////////////////////////////////////////////////////////////////////////
26bncEphUploadCaster::bncEphUploadCaster() {
27 bncSettings settings;
28
29 QString mountpoint = settings.value("uploadEphMountpoint").toString();
30 if (mountpoint.isEmpty()) {
31 _ephUploadCaster = 0;
32 }
33 else {
34 QString outHost = settings.value("uploadEphHost").toString();
35 int outPort = settings.value("uploadEphPort").toInt();
36 QString password = settings.value("uploadEphPassword").toString();
37 int sampl = settings.value("uploadEphSampl").toInt();
38
39 _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
40 password, -1, sampl);
41
42 connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
43 this, SIGNAL(newBytes(QByteArray,double)));
44
45 _ephUploadCaster->start();
46 }
47}
48
49// Destructor
50////////////////////////////////////////////////////////////////////////////
51bncEphUploadCaster::~bncEphUploadCaster() {
52 if (_ephUploadCaster) {
53 _ephUploadCaster->deleteSafely();
54 }
55}
56
57// List of Stored Ephemeris changed (virtual)
58////////////////////////////////////////////////////////////////////////////
59void bncEphUploadCaster::ephBufferChanged() {
60 if (_ephUploadCaster) {
61 QByteArray outBuffer;
62 QMapIterator<QString, t_ephPair*> it(_eph);
63 while (it.hasNext()) {
64 it.next();
65
66 t_eph* eph = it.value()->last;
67 unsigned char Array[80];
68 int size = eph->RTCM3(Array);
69 if (size > 0) {
70 outBuffer += QByteArray((char*) Array, size);
71 }
72 }
73 if (outBuffer.size() > 0) {
74 _ephUploadCaster->setOutBuffer(outBuffer);
75 }
76 }
77}
Note: See TracBrowser for help on using the repository browser.