[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 |
|
---|
| 22 | using namespace std;
|
---|
| 23 |
|
---|
| 24 | // Constructor
|
---|
| 25 | ////////////////////////////////////////////////////////////////////////////
|
---|
[3249] | 26 | bncEphUploadCaster::bncEphUploadCaster() {
|
---|
[3253] | 27 | bncSettings settings;
|
---|
| 28 |
|
---|
| 29 | QString mountpoint = settings.value("uploadEphMountpoint").toString();
|
---|
[3255] | 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();
|
---|
[3253] | 37 |
|
---|
[3255] | 38 | _ephUploadCaster = new bncUploadCaster(mountpoint, outHost, outPort,
|
---|
[3248] | 39 | password, -1);
|
---|
[3254] | 40 |
|
---|
[3255] | 41 | connect(_ephUploadCaster, SIGNAL(newBytes(QByteArray,double)),
|
---|
[3254] | 42 | this, SIGNAL(newBytes(QByteArray,double)));
|
---|
| 43 |
|
---|
[3255] | 44 | _ephUploadCaster->start();
|
---|
| 45 | }
|
---|
[3248] | 46 | }
|
---|
| 47 |
|
---|
| 48 | // Destructor
|
---|
| 49 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 50 | bncEphUploadCaster::~bncEphUploadCaster() {
|
---|
[3255] | 51 | if (_ephUploadCaster) {
|
---|
| 52 | _ephUploadCaster->deleteSafely();
|
---|
| 53 | }
|
---|
[3248] | 54 | }
|
---|
| 55 |
|
---|
| 56 | // List of Stored Ephemeris changed (virtual)
|
---|
| 57 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 58 | void bncEphUploadCaster::ephBufferChanged() {
|
---|
[3255] | 59 | if (_ephUploadCaster) {
|
---|
[3259] | 60 | QByteArray outBuffer;
|
---|
[3256] | 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 | }
|
---|
[3259] | 72 | if (outBuffer.size() > 0) {
|
---|
| 73 | _ephUploadCaster->setOutBuffer(outBuffer);
|
---|
| 74 | }
|
---|
[3255] | 75 | }
|
---|
[3248] | 76 | }
|
---|