-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c99a765
commit 65aeb35
Showing
38 changed files
with
4,200 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#pragma once | ||
|
||
// Main header file for the external interface to the PSK Reporter API | ||
// For documentation see http://psk.gladstonefamily.net/PSKReporterAPI.pdf | ||
|
||
/* | ||
Copyright (c) 2008 Philip Gladstone | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
|
||
|
||
#ifdef _DLL_OPTION_PSKREPORTER_EXPORT | ||
#define DllImportExport __declspec ( dllexport ) | ||
#else | ||
#define DllImportExport __declspec ( dllimport ) | ||
#endif | ||
|
||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#define REPORTER_SOURCE_MASK 0x07 | ||
#define REPORTER_SOURCE_AUTOMATIC 0x01 | ||
#define REPORTER_SOURCE_LOG 0x02 | ||
#define REPORTER_SOURCE_MANUAL 0x03 | ||
#define REPORTER_SOURCE_TENTATIVE 0x40 | ||
#define REPORTER_SOURCE_TEST 0x80 | ||
|
||
typedef struct { | ||
wchar_t hostname[256]; | ||
wchar_t port[32]; | ||
bool connected; | ||
unsigned int callsigns_sent; | ||
unsigned int callsigns_buffered; | ||
unsigned int callsigns_discarded; | ||
unsigned int last_send_time; | ||
unsigned int next_send_time; | ||
wchar_t last_callsign_queued[24]; | ||
unsigned int bytes_sent; | ||
unsigned int bytes_sent_total; | ||
unsigned int packets_sent; | ||
unsigned int packets_sent_total; | ||
} REPORTER_STATISTICS; | ||
|
||
|
||
|
||
|
||
unsigned long DllImportExport __cdecl ReporterInitialize( | ||
const wchar_t *hostname, | ||
const wchar_t *port | ||
); | ||
|
||
unsigned long DllImportExport __cdecl ReporterSeenCallsign( | ||
const wchar_t *remoteInformation, | ||
const wchar_t *localInformation, | ||
unsigned long flags | ||
); | ||
|
||
unsigned long DllImportExport __cdecl ReporterTickle( | ||
); | ||
|
||
unsigned long DllImportExport __cdecl ReporterGetInformation( | ||
wchar_t *buffer, | ||
unsigned long maxlen | ||
); | ||
|
||
unsigned long DllImportExport __cdecl ReporterGetStatistics( | ||
REPORTER_STATISTICS *buffer, | ||
unsigned long maxlen | ||
); | ||
|
||
unsigned long DllImportExport __cdecl ReporterUninitialize( | ||
); | ||
|
||
|
||
unsigned long DllImportExport __stdcall ReporterInitializeSTD( | ||
const char *hostname, | ||
const char *port | ||
); | ||
|
||
unsigned long DllImportExport __stdcall ReporterSeenCallsignSTD( | ||
const char *remoteInformation, | ||
const char *localInformation, | ||
unsigned long flags | ||
); | ||
|
||
unsigned long DllImportExport __stdcall ReporterTickleSTD( | ||
); | ||
|
||
unsigned long DllImportExport __stdcall ReporterGetInformationSTD( | ||
char *buffer, | ||
unsigned long maxlen | ||
); | ||
|
||
unsigned long DllImportExport __stdcall ReporterGetStatisticsSTD( | ||
REPORTER_STATISTICS *buffer, | ||
unsigned long maxlen | ||
); | ||
|
||
unsigned long DllImportExport __stdcall ReporterUninitializeSTD( | ||
); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# | ||
/* | ||
* Copyright (C) 2010, 2011, 2012, 2013 | ||
* Jan van Katwijk ([email protected]) | ||
* Lazy Chair Programming | ||
* | ||
* This file is part of swradio | ||
* | ||
* swradio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* swradio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with swradio; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
// | ||
// to be included by the main program of the decoder | ||
|
||
#include <stdint.h> | ||
#include <complex> | ||
|
||
class Cache { | ||
private: | ||
int nrows; | ||
int ncolums; | ||
std::complex<float> **data; | ||
|
||
public: | ||
Cache (int16_t ncolums, int16_t nrows) { | ||
int16_t i; | ||
|
||
this -> ncolums = ncolums; | ||
this -> nrows = nrows; | ||
data = new std::complex<float> *[nrows]; | ||
for (i = 0; i < nrows; i++) | ||
data [i] = new std::complex<float> [ncolums]; | ||
fprintf (stderr, "new cache with %d rows and %d colums\n", | ||
nrows, ncolums); | ||
} | ||
|
||
~Cache (void) { | ||
int i; | ||
for (i = 0; i < nrows; i ++) | ||
delete[] data [i]; | ||
|
||
delete[] data; | ||
} | ||
|
||
std::complex<float> *cacheLine (int16_t n) { | ||
return data [n]; | ||
} | ||
|
||
std::complex<float> cacheElement (int16_t line, int16_t element) { | ||
return data [line] [element]; | ||
} | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# | ||
/* | ||
* Copyright (C) 2010, 2011, 2012, 2013 | ||
* Jan van Katwijk ([email protected]) | ||
* Lazy Chair Computing | ||
* | ||
* This file is part of swradio | ||
* | ||
* swradio is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* swradio is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with swradio; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
#ifndef __DL_CACHE__ | ||
#define __DL_CACHE__ | ||
|
||
#include <string> | ||
#include <vector> | ||
typedef struct { | ||
float strength; | ||
float frequency; | ||
std::string theMessage; | ||
} cacheElement; | ||
|
||
class dlCache { | ||
private: | ||
std::vector<cacheElement> cache; | ||
int p; | ||
int size; | ||
#define CACHE_SIZE 32 | ||
#define CACHE_MASK (CACHE_SIZE - 1) | ||
public: | ||
dlCache (int size) { | ||
(void)size; | ||
cache. resize (CACHE_SIZE); | ||
this -> size = CACHE_SIZE; | ||
p = 0; | ||
} | ||
|
||
~dlCache () { | ||
} | ||
|
||
void add (const std::string &s, | ||
float strength, float frequency) { | ||
cache [p]. strength = strength; | ||
cache [p]. frequency = frequency; | ||
cache [p]. theMessage = s; | ||
p = (p + 1) & CACHE_MASK; | ||
} | ||
|
||
bool update (float strength, | ||
float frequency, const std::string &s) { | ||
for (uint16_t i = p; i < p + CACHE_SIZE; i ++) { | ||
if (cache [i & CACHE_MASK]. theMessage == s) { | ||
if (cache [i & CACHE_MASK]. strength < strength) { | ||
for (uint16_t j = i; j < (p - 1) + CACHE_SIZE; j ++) | ||
cache [j & CACHE_MASK] = cache [(j + 1) & CACHE_MASK]; | ||
cache [(p - 1 + CACHE_SIZE) & CACHE_MASK]. theMessage = s; | ||
cache [(p - 1 + CACHE_SIZE) & CACHE_MASK]. strength = strength; | ||
cache [(p - 1 + CACHE_SIZE) & CACHE_MASK]. frequency = | ||
frequency; | ||
|
||
} | ||
return true; | ||
} | ||
} | ||
cache [p]. theMessage = s; | ||
cache [p]. strength = strength; | ||
cache [p]. frequency = frequency; | ||
p = (p + 1) & CACHE_MASK; | ||
return false; | ||
} | ||
}; | ||
#endif |
Oops, something went wrong.