
About
libCATS is an implementation of the CATS standard in C, intended for embedded use in firmware for CATS radios, as well as desktop CATS software. It provides a simple API for encoding and decoding CATS packets and their component whiskers. Software using libCATS does not have to be concerned with any 'low level' parts of the CATS standard, however those functions are still exposed in the API to allow for flexibility in software where it may be useful to not have everything abstracted.
libCATS aims to be 100% compliant with the CATS standard, and should work with existing CATS radios using the official Rust implementation of CATS.
Examples
Note: API is subject to change, as it is early in development
Creating a simple packet with a callsign and comment:
uint8_t* buf = NULL;
int len = cats_packet_build(pkt, &buf);
free(pkt);
int cats_packet_add_comment(cats_packet_t *pkt, const char *comment)
Add a comment whisker to a packet.
Definition comment.c:36
int cats_packet_prepare(cats_packet_t **pkt)
Initialize a cats_packet_t pointer.
Definition packet.c:15
int cats_packet_add_identification(cats_packet_t *pkt, const char *callsign, uint8_t ssid, uint16_t icon)
Add an identification whisker to a packet.
Definition identification.c:48
CATS packet structure.
Definition packet.h:21
Decoding a packet and reading the identification and comment fields:
uint8_t* buf = ...
if(!cats_packet_from_buf(pkt, buf, bufLen)) {
return -1;
}
char comment[1024];
char callsign[255];
uint8_t ssid;
uint16_t icon;
free(buf);
free(pkt);
char cats_error_str[255]
Error string for the most recent error thrown by libCATS.
Definition error.c:7
int cats_packet_get_comment(const cats_packet_t *pkt, char *out)
Get the comment whisker from a packet.
Definition comment.c:9
int cats_packet_get_identification(const cats_packet_t *pkt, cats_ident_whisker_t **out)
Get the identification whisker from a packet.
Definition identification.c:32
Contributing
Pull requests are VERY much welcome! I'm still a novice when it comes to writing pure C, so there's a lot that can be improved.