summaryrefslogtreecommitdiff
path: root/lib/wsprd/wsprd_utils.h
blob: 62c653e84fc4fa58cf33bc4df73d463fd5d5c449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef WSPRD_UTILS_H
#define WSPRD_UTILS_H

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <stdint.h>
#include <time.h>
#include "nhash.h"

enum {
    WSPRD_CALLSIGN_SIZE = 13,
    WSPRD_GRID4_SIZE = 5,
    WSPRD_GRID6_SIZE = 7,
    WSPRD_MESSAGE_SIZE = 23,
    WSPRD_HASH_COUNT = 32768
};

void unpack50( signed char *dat, int32_t *n1, int32_t *n2 );

int unpackcall( int32_t ncall, char *call );

int unpackgrid( int32_t ngrid, char *grid);

int unpackpfx( int32_t nprefix, char *call);

void deinterleave(unsigned char *sym);

// used by qsort
int doublecomp(const void* elem1, const void* elem2);
int floatcomp(const void* elem1, const void* elem2);

int unpk_( signed char *message, char* hashtab, char* loctab, char *call_loc_pow, char *callsign);

int wsprd_load_hash_line(char const *line, char *hashtab, char *loctab);

#endif