Moved from MySQL to new set of D-BUS methods to retreive station call / ID
This commit is contained in:
parent
f9bcb35800
commit
b99aeaa581
17 changed files with 294 additions and 424 deletions
|
@ -4,8 +4,7 @@
|
|||
#include <stdio.h>
|
||||
#include <pcre.h>
|
||||
|
||||
#include "PatchCordProxy.h"
|
||||
#include "UserDataStore.h"
|
||||
#include "PatchCord.h"
|
||||
|
||||
#define VECTORS_COUNT 16
|
||||
#define DEFAULT_USER_NUMBER 1
|
||||
|
@ -17,7 +16,7 @@ int main(int argc, const char* argv[])
|
|||
{
|
||||
printf("\n");
|
||||
printf("CallCapture for BrandMeister DMR Master Server\n");
|
||||
printf("Copyright 2015 Artem Prilutskiy (R3ABM, cyanide.burnout@gmail.com)\n");
|
||||
printf("Copyright 2015-2017 Artem Prilutskiy (R3ABM, cyanide.burnout@gmail.com)\n");
|
||||
printf("\n");
|
||||
|
||||
// Start up
|
||||
|
@ -25,7 +24,6 @@ int main(int argc, const char* argv[])
|
|||
struct option options[] =
|
||||
{
|
||||
{ "expression", required_argument, NULL, 'e' },
|
||||
{ "connection", required_argument, NULL, 'c' },
|
||||
{ "identity", required_argument, NULL, 'i' },
|
||||
{ "network", required_argument, NULL, 'n' },
|
||||
{ "unknown", required_argument, NULL, 'u' },
|
||||
|
@ -34,7 +32,6 @@ int main(int argc, const char* argv[])
|
|||
};
|
||||
|
||||
pcre* expression = NULL;
|
||||
const char* file = NULL;
|
||||
uint32_t network = 0;
|
||||
uint32_t unknown = DEFAULT_USER_NUMBER;
|
||||
uint32_t link = DEFAULT_LINK_NUMBER;
|
||||
|
@ -43,17 +40,13 @@ int main(int argc, const char* argv[])
|
|||
const char* error = NULL;
|
||||
|
||||
int selection = 0;
|
||||
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:c:u:n:l:", options, NULL)) != EOF)
|
||||
while ((selection = getopt_long(argc, const_cast<char* const*>(argv), "e:u:n:l:", options, NULL)) != EOF)
|
||||
switch (selection)
|
||||
{
|
||||
case 'e':
|
||||
expression = pcre_compile(optarg, 0, &error, &position, NULL);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
file = optarg;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
openlog(optarg, 0, LOG_USER);
|
||||
break;
|
||||
|
@ -79,13 +72,11 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
|
||||
if ((expression == NULL) ||
|
||||
(network == 0) ||
|
||||
(file == NULL))
|
||||
(network == 0))
|
||||
{
|
||||
printf(
|
||||
"Usage: %s\n"
|
||||
" --expression <regular expression>\n"
|
||||
" --connection <path to configuration file>\n"
|
||||
" [--unknown <ID for unknown call-signs>]\n"
|
||||
" --network <network number>\n"
|
||||
" --link <link number>\n"
|
||||
|
@ -100,8 +91,7 @@ int main(int argc, const char* argv[])
|
|||
|
||||
// Main
|
||||
|
||||
UserDataStore store(file);
|
||||
PatchCordProxy proxy(network, link);
|
||||
PatchCord proxy(network, link);
|
||||
|
||||
char* line = NULL;
|
||||
size_t length = 0;
|
||||
|
@ -122,7 +112,7 @@ int main(int argc, const char* argv[])
|
|||
pcre_get_named_substring(expression, line, vectors, count, "call", &call);
|
||||
pcre_get_named_substring(expression, line, vectors, count, "alias", &alias);
|
||||
|
||||
uint32_t number = store.getPrivateIDForCall(call);
|
||||
uint32_t number = proxy.getPrivateIDForCall(call); // This method moved from MySQL connector to proxt
|
||||
|
||||
if (number == 0)
|
||||
number = unknown;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue