Debian Codegraph @

_modes.h

raw symbols SCIP
1 #ifndef _MODES_H
2 #define _MODES_H
3
4 /*
5 * Part of mlat-client - an ADS-B multilateration client.
6 * Copyright 2015, Oliver Jowett <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 #include <Python.h>
23 #include <structmember.h>
24
25 #include <stdint.h>
26
27 /* a modesmessage object */
28 typedef struct {
29 PyObject_HEAD
30
31 unsigned long long timestamp;
32 unsigned int signal;
33
34 unsigned int df;
35 unsigned int nuc;
36 char even_cpr;
37 char odd_cpr;
38 char valid;
39 PyObject *crc;
40 PyObject *address;
41 PyObject *altitude;
42
43 uint8_t *data;
44 int datalen;
45
46 PyObject *eventdata;
47 } modesmessage;
48
49 /* special DF types for non-Mode-S messages */
50 #define DF_MODEAC 32
51 #define DF_EVENT_TIMESTAMP_JUMP 33
52 #define DF_EVENT_MODE_CHANGE 34
53 #define DF_EVENT_EPOCH_ROLLOVER 35
54 #define DF_EVENT_RADARCAPE_STATUS 36
55 #define DF_EVENT_RADARCAPE_POSITION 37
56
57 /* factory function to build a modesmessage from a provided buffer */
58 PyObject *modesmessage_from_buffer(unsigned long long timestamp, unsigned signal, uint8_t *data, int datalen);
59 /* factory function to build an event message */
60 PyObject *modesmessage_new_eventmessage(int type, unsigned long long timestamp, PyObject *eventdata);
61 /* python entry point */
62 PyObject *modesmessage_eventmessage(PyObject *self, PyObject *args, PyObject *kwds);
63
64 /* crc helpers */
65 uint32_t modescrc_buffer_crc(uint8_t *buf, Py_ssize_t len); /* internal interface */
66 PyObject *modescrc_crc(PyObject *self, PyObject *args); /* external interface */
67
68 /* submodule init/cleanup */
69 int modescrc_module_init(PyObject *m);
70 void modescrc_module_free(PyObject *m);
71 int modesreader_module_init(PyObject *m);
72 void modesreader_module_free(PyObject *m);
73 int modesmessage_module_init(PyObject *m);
74 void modesmessage_module_free(PyObject *m);
75
76 #endif