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

Last change on this file since 4277 was 3582, checked in by mervart, 13 years ago
File size: 2.2 KB
RevLine 
[3248]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
[3258]17#include <iostream>
[3248]18#include <math.h>
19#include "bncephuploadcaster.h"
[3253]20#include "bncsettings.h"
[3248]21
22using namespace std;
23
24// Constructor
25////////////////////////////////////////////////////////////////////////////
[3249]26bncEphUploadCaster::bncEphUploadCaster() {
[3253]27 bncSettings settings;
28
29 QString mountpoint = settings.value("uploadEphMountpoint").toString();
[3255]30 if (mountpoint.isEmpty()) {
31 _ephUploadCaster = 0;
32 }
33 else {
[3273]34 QString outHost = settings.value("uploadEphHost").toString();
35 int outPort = settings.value("uploadEphPort").toInt();
36 QString password = settings.value("uploadEphPassword").toString();
[3582]37 int sampl = settings.value("uploadEphSampl").toInt();
[3253]38
[3255]39 _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
[3273]40 password, -1, sampl);
[3254]41
[3255]42 connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
[3254]43 this, SIGNAL(newBytes(QByteArray,double)));
44
[3255]45 _ephUploadCaster->start();
46 }
[3248]47}
48
49// Destructor
50////////////////////////////////////////////////////////////////////////////
51bncEphUploadCaster::~bncEphUploadCaster() {
[3255]52 if (_ephUploadCaster) {
53 _ephUploadCaster->deleteSafely();
54 }
[3248]55}
56
57// List of Stored Ephemeris changed (virtual)
58////////////////////////////////////////////////////////////////////////////
59void bncEphUploadCaster::ephBufferChanged() {
[3255]60 if (_ephUploadCaster) {
[3259]61 QByteArray outBuffer;
[3256]62 QMapIterator<QString, t_ephPair*> it(_eph);
63 while (it.hasNext()) {
64 it.next();
65
66 t_eph* eph = it.value()->last;
[3283]67 unsigned char Array[80];
[3256]68 int size = eph->RTCM3(Array);
69 if (size > 0) {
70 outBuffer += QByteArray((char*) Array, size);
71 }
72 }
[3259]73 if (outBuffer.size() > 0) {
74 _ephUploadCaster->setOutBuffer(outBuffer);
75 }
[3255]76 }
[3248]77}
Note: See TracBrowser for help on using the repository browser.