jbrunink / p2000scanner Goto Github PK
View Code? Open in Web Editor NEWA p2000 paging decoder
License: GNU General Public License v3.0
A p2000 paging decoder
License: GNU General Public License v3.0
P2000SCANNER: A P2000 PAGING DECODER (VERSION 1.0-BETA) (http://p2000scanner.watiserloos.in) -------------------------------------------------------------------------------------------- p2000scanner is CLI-based *nix application written in C. It uses RS232 to communicate with a receiver (confirmed to work with Flexbox and FTDI-based RS232-USB converter). It can be used in several modes, it can decode all the received information and just present that, it can write all the decoded information to a file (JSON-formatted) and/or send it with ZMQ (pubsub implementation) to subscribers (also JSON-formatted). At the moment p2000scanner only supports 1600-bit/2-FSK FLEX. (used in the Netherlands) Example message: { "data": { "type": "ALPHA", "mode": "FLEX", "timestamp": "1370592337", "message": "test", "capcodes": [ "1023032" ] }, "extra": { "isGroupMessage": false, "containsUnknownCharacters": false } } p2000scanner is still in beta, but has been confirmed to compile and run on: - Ubuntu 10.04.4 LTS (AMD64) with GCC 4.4.3 - Debian 7 (ARMv61) with GCC 4.6.3 Do note that most of code came from the PDW branch and thus much of it still needs a lot (really, lots of lot) of cleaning-up. Sorry for that. Most of the code (if not all) still needs documentation, transformation to hungarian notation, logical function naming, error handling. It's very basic at the moment, we're working on that. Working cases ------------- Despite that p2000scanner is in beta, it is very stable. It's Valgrind-safe (hehe), and over 150.000 FLEX-messages only 9 of them we're not properly decoded. Requirements ------------ p2000scanner is a application written in C (C99). - ZMQ >= 3.2.2 (http://www.zeromq.org/) - libconfig >= 1.3.2 (http://www.hyperrealm.com/libconfig/) - libjson >= 0.9 (https://github.com/json-c/json-c) Usage ----- p2000scanner is designed to run in daemonized mode, and read it's configuration parameters from a configuration file (default is p2000scanner.cfg). When parameters are specified on the command-line, no daemonization will occur unless specified by the --daemonize switch. All parameters on the command-line will precede over the parameters in the configuration file. A list of all possible switches/parameters can be found in this file. NOTE: As of June 2013 this has not been implemented yet, the only supported and REQUIRED switch is '--device=/dev/usbtty0' and '-d' (same functionality). This specifies the device which to use. A log file 'binary-data.log' is also by default enabled, in this file all the messages will be logged in JSON format. The IP where ZMQ needs to bind on, and more parameters are hardcoded in the source, these are not properly documented. Switches/parameters ------------------- TODO Description of the directories: ------------------------------- p2000scanner: Contains the source code for the application, this directory also contains the buildscript. examples: Contains examples for clientside code (Perl and C). Building the application ------------------------ You can build p2000scanner by running the following command which in turn uses GCC to compile: ./build.sh This will create an executable in the current working directory, called 'scanner'. Bug reports ----------- Please send bug reports to [email protected] and please include as much information as you can. You can also contribute to the source by Git. For more information, please see our website http://p2000scanner.watiserloos.in.
I hereby confirm to have your software working on a Raspberry Pi. There is no issue, but this seems the only way to let you know.
I've used the RS232 interface from discriminiator.nl, took out the MAX232, soldered in some resistors to make a voltage divider to bring the PIC's output down to 3.3 volt to be handled by the RasPi's UART input.
After some fiddling with the dependencies, your software worked right away :-)
In the other issue, you mentioned you'd want to receive some raw dumps. I you tell me how, I'd be happy to provide them.
I'd don't have to much experience with C, but I'll try to look into your code some more.
I'm trying to compile this on ubuntu 14.04 but I get the following output:
$ ./build.sh
Building scanner
scanner.c: In function ‘FlexTIME’:
scanner.c:674:17: warning: variable ‘bDate’ set but not used [-Wunused-but-set-variable]
int bTime = 0, bDate = 0;
^
scanner.c:674:6: warning: variable ‘bTime’ set but not used [-Wunused-but-set-variable]
int bTime = 0, bDate = 0;
^
scanner.c:671:26: warning: variable ‘FLEX_date’ set but not used [-Wunused-but-set-variable]
static int FLEX_time=0, FLEX_date=0;
^
scanner.c:671:13: warning: variable ‘FLEX_time’ set but not used [-Wunused-but-set-variable]
static int FLEX_time=0, FLEX_date=0;
^
scanner.c:662:30: warning: variable ‘minutes’ set but not used [-Wunused-but-set-variable]
int year, month, day, hour, minutes;
^
scanner.c:662:24: warning: variable ‘hour’ set but not used [-Wunused-but-set-variable]
int year, month, day, hour, minutes;
^
scanner.c:662:19: warning: variable ‘day’ set but not used [-Wunused-but-set-variable]
int year, month, day, hour, minutes;
^
scanner.c:662:12: warning: variable ‘month’ set but not used [-Wunused-but-set-variable]
int year, month, day, hour, minutes;
^
scanner.c:662:6: warning: variable ‘year’ set but not used [-Wunused-but-set-variable]
int year, month, day, hour, minutes;
^
scanner.c: In function ‘frame_flex’:
scanner.c:1334:11: warning: variable ‘reflex’ set but not used [-Wunused-but-set-variable]
int reflex = 1;
^
/tmp/ccJNf69j.o: In function `req_socket_monitor':
scanner.c:(.text+0x348): undefined reference to `zmq_socket'
scanner.c:(.text+0x37d): undefined reference to `zmq_connect'
scanner.c:(.text+0x3b0): undefined reference to `zmq_msg_init'
scanner.c:(.text+0x3c8): undefined reference to `zmq_recvmsg'
scanner.c:(.text+0x3d6): undefined reference to `zmq_errno'
scanner.c:(.text+0x3eb): undefined reference to `zmq_strerror'
scanner.c:(.text+0x414): undefined reference to `zmq_strerror'
scanner.c:(.text+0x454): undefined reference to `zmq_msg_data'
scanner.c:(.text+0x579): undefined reference to `zmq_msg_close'
scanner.c:(.text+0x5a2): undefined reference to `zmq_close'
/tmp/ccJNf69j.o: In function `parseSingleMessage':
scanner.c:(.text+0x61f): undefined reference to `json_object_new_object'
scanner.c:(.text+0x62b): undefined reference to `json_object_new_object'
scanner.c:(.text+0x637): undefined reference to `json_object_new_object'
scanner.c:(.text+0x659): undefined reference to `json_object_object_add'
scanner.c:(.text+0x674): undefined reference to `json_object_object_add'
scanner.c:(.text+0x679): undefined reference to `json_object_new_array'
scanner.c:(.text+0x687): undefined reference to `json_object_new_string'
scanner.c:(.text+0x69e): undefined reference to `json_object_array_add'
scanner.c:(.text+0x6a8): undefined reference to `json_object_new_string'
scanner.c:(.text+0x6c4): undefined reference to `json_object_object_add'
scanner.c:(.text+0x6ce): undefined reference to `json_object_new_string'
scanner.c:(.text+0x6ea): undefined reference to `json_object_object_add'
scanner.c:(.text+0x6f4): undefined reference to `json_object_new_string'
scanner.c:(.text+0x710): undefined reference to `json_object_object_add'
scanner.c:(.text+0x71a): undefined reference to `json_object_new_string'
scanner.c:(.text+0x736): undefined reference to `json_object_object_add'
scanner.c:(.text+0x740): undefined reference to `json_object_new_boolean'
scanner.c:(.text+0x75c): undefined reference to `json_object_object_add'
scanner.c:(.text+0x769): undefined reference to `json_object_new_boolean'
scanner.c:(.text+0x785): undefined reference to `json_object_object_add'
scanner.c:(.text+0x7a7): undefined reference to `json_object_object_add'
scanner.c:(.text+0x7b6): undefined reference to `json_object_to_json_string'
scanner.c:(.text+0x7d7): undefined reference to `json_object_to_json_string'
scanner.c:(.text+0x85e): undefined reference to `zmq_msg_init_data'
scanner.c:(.text+0x879): undefined reference to `zmq_msg_send'
scanner.c:(.text+0x899): undefined reference to `json_object_put'
/tmp/ccJNf69j.o: In function `ConvertGroupcall':
scanner.c:(.text+0xa19): undefined reference to `json_object_new_object'
scanner.c:(.text+0xa25): undefined reference to `json_object_new_object'
scanner.c:(.text+0xa31): undefined reference to `json_object_new_object'
scanner.c:(.text+0xa53): undefined reference to `json_object_object_add'
scanner.c:(.text+0xa6e): undefined reference to `json_object_object_add'
scanner.c:(.text+0xa73): undefined reference to `json_object_new_array'
scanner.c:(.text+0xb07): undefined reference to `json_object_new_string'
scanner.c:(.text+0xb21): undefined reference to `json_object_array_add'
scanner.c:(.text+0xb8f): undefined reference to `json_object_new_string'
scanner.c:(.text+0xba9): undefined reference to `json_object_array_add'
scanner.c:(.text+0xbb3): undefined reference to `json_object_new_string'
scanner.c:(.text+0xbcf): undefined reference to `json_object_object_add'
scanner.c:(.text+0xbd9): undefined reference to `json_object_new_string'
scanner.c:(.text+0xbf5): undefined reference to `json_object_object_add'
scanner.c:(.text+0xbff): undefined reference to `json_object_new_string'
scanner.c:(.text+0xc1b): undefined reference to `json_object_object_add'
scanner.c:(.text+0xc25): undefined reference to `json_object_new_string'
scanner.c:(.text+0xc41): undefined reference to `json_object_object_add'
scanner.c:(.text+0xc4b): undefined reference to `json_object_new_boolean'
scanner.c:(.text+0xc67): undefined reference to `json_object_object_add'
scanner.c:(.text+0xc74): undefined reference to `json_object_new_boolean'
scanner.c:(.text+0xc90): undefined reference to `json_object_object_add'
scanner.c:(.text+0xcb5): undefined reference to `json_object_object_add'
scanner.c:(.text+0xcc4): undefined reference to `json_object_to_json_string'
scanner.c:(.text+0xcef): undefined reference to `json_object_to_json_string'
scanner.c:(.text+0xd10): undefined reference to `json_object_to_json_string'
scanner.c:(.text+0xd7a): undefined reference to `zmq_msg_init_data'
scanner.c:(.text+0xd95): undefined reference to `zmq_msg_send'
scanner.c:(.text+0xdb5): undefined reference to `json_object_put'
/tmp/ccJNf69j.o: In function `main':
scanner.c:(.text+0x263c): undefined reference to `zmq_ctx_new'
scanner.c:(.text+0x2657): undefined reference to `zmq_socket'
scanner.c:(.text+0x2688): undefined reference to `zmq_setsockopt'
scanner.c:(.text+0x269c): undefined reference to `zmq_bind'
scanner.c:(.text+0x26c9): undefined reference to `zmq_socket_monitor'
scanner.c:(.text+0x2b19): undefined reference to `zmq_unbind'
scanner.c:(.text+0x2b39): undefined reference to `zmq_close'
scanner.c:(.text+0x2b59): undefined reference to `zmq_ctx_destroy'
collect2: error: ld returned 1 exit status
I'm compiling with:
Hi, I was wondering if you could help with some compile errors. I'm attempting to compile this on a raspberry pi. libzmq1, libzmq-dev version 2.2.0
$ ./build.sh
Building scanner
scanner.c: In function 'req_socket_monitor':
scanner.c:287:2: error: unknown type name 'zmq_event_t'
scanner.c:300:3: warning: implicit declaration of function 'zmq_recvmsg' [-Wimplicit-function-declaration]
scanner.c:312:16: error: request for member 'event' in something not a structure or union
scanner.c:314:9: error: 'ZMQ_EVENT_CONNECTED' undeclared (first use in this function)
scanner.c:314:9: note: each undeclared identifier is reported only once for each function it appears in
scanner.c:315:52: error: request for member 'data' in something not a structure or union
scanner.c:316:75: error: request for member 'data' in something not a structure or union
scanner.c:319:9: error: 'ZMQ_EVENT_CLOSED' undeclared (first use in this function)
scanner.c:321:9: error: 'ZMQ_EVENT_ACCEPTED' undeclared (first use in this function)
scanner.c:322:37: error: request for member 'data' in something not a structure or union
scanner.c:323:56: error: request for member 'data' in something not a structure or union
scanner.c:326:9: error: 'ZMQ_EVENT_DISCONNECTED' undeclared (first use in this function)
scanner.c:327:39: error: request for member 'data' in something not a structure or union
scanner.c:328:59: error: request for member 'data' in something not a structure or union
scanner.c: In function 'parseSingleMessage':
scanner.c:396:2: warning: implicit declaration of function 'zmq_msg_send' [-Wimplicit-function-declaration]
scanner.c: In function 'FlexTIME':
scanner.c:674:17: warning: variable 'bDate' set but not used [-Wunused-but-set-variable]
scanner.c:674:6: warning: variable 'bTime' set but not used [-Wunused-but-set-variable]
scanner.c:671:26: warning: variable 'FLEX_date' set but not used [-Wunused-but-set-variable]
scanner.c:671:13: warning: variable 'FLEX_time' set but not used [-Wunused-but-set-variable]
scanner.c:662:30: warning: variable 'minutes' set but not used [-Wunused-but-set-variable]
scanner.c:662:24: warning: variable 'hour' set but not used [-Wunused-but-set-variable]
scanner.c:662:19: warning: variable 'day' set but not used [-Wunused-but-set-variable]
scanner.c:662:12: warning: variable 'month' set but not used [-Wunused-but-set-variable]
scanner.c:662:6: warning: variable 'year' set but not used [-Wunused-but-set-variable]
scanner.c: In function 'frame_flex':
scanner.c:1334:11: warning: variable 'reflex' set but not used [-Wunused-but-set-variable]
scanner.c: In function 'main':
scanner.c:1590:2: warning: implicit declaration of function 'zmq_ctx_new' [-Wimplicit-function-declaration]
scanner.c:1590:10: warning: assignment makes pointer from integer without a cast [enabled by default]
scanner.c:1594:25: error: 'ZMQ_IPV4ONLY' undeclared (first use in this function)
scanner.c:1603:2: warning: implicit declaration of function 'zmq_socket_monitor' [-Wimplicit-function-declaration]
scanner.c:1603:53: error: 'ZMQ_EVENT_ALL' undeclared (first use in this function)
scanner.c:1762:2: warning: implicit declaration of function 'zmq_unbind' [-Wimplicit-function-declaration]
scanner.c:1764:2: warning: implicit declaration of function 'zmq_ctx_destroy' [-Wimplicit-function-declaration]
I also saw that this only decodes FLEX 1600. Any plans on extending this to work with other FLEX modes (6400 is mainly in use where I am) and POCSAG?
any plans to make this work with usb sdr ?
Env: CentOS 7.2 zerozmq 1.4.5 installed in /usr/local/lib (default)
./buid.sh results in:
scanner.c:287:2: error: unknown type name ‘zmq_event_t’
zmq_event_t event;
^
scanner.c:312:16: error: request for member ‘event’ in something not a structure or union
switch (event.event)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.