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

Last change on this file since 3266 was 3259, checked in by mervart, 14 years ago
File size: 2.1 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
38 _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
39 password, -1);
40
41 connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
42 this, SIGNAL(newBytes(QByteArray,double)));
43
44 _ephUploadCaster->start();
45 }
46}
47
48// Destructor
49////////////////////////////////////////////////////////////////////////////
50bncEphUploadCaster::~bncEphUploadCaster() {
51 if (_ephUploadCaster) {
52 _ephUploadCaster->deleteSafely();
53 }
54}
55
56// List of Stored Ephemeris changed (virtual)
57////////////////////////////////////////////////////////////////////////////
58void bncEphUploadCaster::ephBufferChanged() {
59 if (_ephUploadCaster) {
60 QByteArray outBuffer;
61 QMapIterator<QString, t_ephPair*> it(_eph);
62 while (it.hasNext()) {
63 it.next();
64
65 t_eph* eph = it.value()->last;
66 unsigned char Array[67];
67 int size = eph->RTCM3(Array);
68 if (size > 0) {
69 outBuffer += QByteArray((char*) Array, size);
70 }
71 }
72 if (outBuffer.size() > 0) {
73 _ephUploadCaster->setOutBuffer(outBuffer);
74 }
75 }
76}
Note: See TracBrowser for help on using the repository browser.