libCATS
All Classes Files Functions Variables Typedefs Enumerations Pages
Classes | Macros | Typedefs | Enumerations | Functions
whisker.h File Reference

Whisker handling. More...

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  nodeinfo_voltage
 
struct  nodeinfo_u8
 
struct  nodeinfo_i8
 
struct  nodeinfo_u16
 
struct  nodeinfo_i16
 
struct  nodeinfo_u32
 
struct  nodeinfo_i32
 
struct  nodeinfo_f32
 
struct  nodeinfo_bool
 
struct  cats_ident_whisker
 
struct  cats_gps_whisker
 
struct  cats_route_hop
 
struct  cats_route_whisker
 
struct  cats_destination_whisker
 
struct  cats_simplex_whisker
 
struct  cats_repeater_whisker
 
struct  cats_nodeinfo_whisker
 
union  cats_whisker_data
 
struct  cats_whisker
 

Macros

#define CATS_ROUTE_PAST   0xFF
 
#define CATS_ROUTE_FUTURE   0xFD
 
#define CATS_ROUTE_INET   0xFE
 
#define CATS_NODEINFO_HARDWARE_ID   1
 
#define CATS_NODEINFO_SOFTWARE_ID   2
 
#define CATS_NODEINFO_UPTIME   4
 
#define CATS_NODEINFO_ANTENNA_HEIGHT   8
 
#define CATS_NODEINFO_ANTENNA_GAIN   16
 
#define CATS_NODEINFO_TX_POWER   32
 
#define CATS_NODEINFO_VOLTAGE   64
 
#define CATS_NODEINFO_TEMP   128
 
#define CATS_NODEINFO_BATTERY   256
 
#define CATS_NODEINFO_ALTITUDE   512
 
#define CATS_NODEINFO_IS_BALLOON   1024
 
#define CATS_NODEINFO_AMBIENT_TEMP   2048
 
#define CATS_NODEINFO_AMBIENT_HUMIDITY   4096
 
#define CATS_NODEINFO_AMBIENT_PRESSURE   8192
 
#define CATS_MAX_WHISKER_LEN   255
 
#define CATS_MAX_WHISKERS   255
 
#define CATS_NUM_WHISKER_TYPES   10
 

Typedefs

typedef enum cats_whisker_type cats_whisker_type_t
 
typedef enum cats_modulation cats_modulation_t
 
typedef struct cats_ident_whisker cats_ident_whisker_t
 
typedef struct cats_gps_whisker cats_gps_whisker_t
 
typedef struct cats_route_hop cats_route_hop_t
 
typedef struct cats_route_whisker cats_route_whisker_t
 
typedef struct cats_destination_whisker cats_destination_whisker_t
 
typedef struct cats_simplex_whisker cats_simplex_whisker_t
 
typedef struct cats_repeater_whisker cats_repeater_whisker_t
 
typedef struct cats_nodeinfo_whisker cats_nodeinfo_whisker_t
 
typedef union cats_whisker_data cats_whisker_data_t
 
typedef struct cats_whisker cats_whisker_t
 

Enumerations

enum  cats_whisker_type {
  WHISKER_TYPE_IDENTIFICATION , WHISKER_TYPE_TIMESTAMP , WHISKER_TYPE_GPS , WHISKER_TYPE_COMMENT ,
  WHISKER_TYPE_ROUTE , WHISKER_TYPE_DESTINATION , WHISKER_TYPE_ARBITRARY , WHISKER_TYPE_SIMPLEX ,
  WHISKER_TYPE_REPEATER , WHISKER_TYPE_NODEINFO
}
 
enum  cats_modulation {
  MOD_UNK , MOD_CATS , MOD_FM , MOD_AM ,
  MOD_USB , MOD_LSB , MOD_CW , MOD_FREEDV ,
  MOD_M17 , MOD_DSTAR , MOD_DMR , MOD_FUSION ,
  MOD_P25
}
 

Functions

size_t cats_whisker_encode (const cats_whisker_t *whisker, uint8_t *out)
 Encode a whisker into a byte array.
 
int cats_whisker_decode (const uint8_t *data, cats_whisker_t *out)
 Decode a whisker from a byte array.
 
int cats_whisker_base_len (const cats_whisker_type_t type)
 Get the length of a whisker base type.
 
cats_whisker_tcats_whisker_new ()
 Create a new whisker.
 
cats_route_hop_tcats_route_add_future_hop (cats_route_whisker_t *route, const char *callsign, uint8_t ssid)
 Add a future hop to a route whisker.
 
cats_route_hop_tcats_route_add_past_hop (cats_route_whisker_t *route, const char *callsign, uint8_t ssid, float rssi)
 Add a past hop to a route whisker.
 
cats_route_hop_tcats_route_add_inet_hop (cats_route_whisker_t *route)
 Add an internet hop to a route whisker.
 
void cats_route_destroy (cats_route_whisker_t *route)
 Destroy a route whisker.
 
cats_route_whisker_t cats_route_new (uint8_t max_digipeats)
 Create a new route whisker.
 

Detailed Description

Whisker handling.

Function Documentation

◆ cats_route_add_future_hop()

cats_route_hop_t * cats_route_add_future_hop ( cats_route_whisker_t * route,
const char * callsign,
uint8_t ssid )

Add a future hop to a route whisker.

Parameters
routeThe route whisker to add to
callsignThe callsign of the hop
ssidThe SSID of the hop
Returns
A pointer to the new hop

◆ cats_route_add_inet_hop()

cats_route_hop_t * cats_route_add_inet_hop ( cats_route_whisker_t * route)

Add an internet hop to a route whisker.

Parameters
routeThe route whisker to add to
Returns
A pointer to the new hop

◆ cats_route_add_past_hop()

cats_route_hop_t * cats_route_add_past_hop ( cats_route_whisker_t * route,
const char * callsign,
uint8_t ssid,
float rssi )

Add a past hop to a route whisker.

Parameters
routeThe route whisker to add to
callsignThe callsign of the hop
ssidThe SSID of the hop
rssiThe RSSI of the hop
Returns
A pointer to the new hop

◆ cats_route_destroy()

void cats_route_destroy ( cats_route_whisker_t * route)

Destroy a route whisker.

Parameters
routeThe route whisker to destroy
Note
This function must be used rather than free()

◆ cats_route_new()

cats_route_whisker_t cats_route_new ( uint8_t max_digipeats)

Create a new route whisker.

Parameters
max_digipeatsThe maximum number of digipeats
Returns
The new route whisker

◆ cats_whisker_base_len()

int cats_whisker_base_len ( const cats_whisker_type_t type)

Get the length of a whisker base type.

Parameters
typeThe whisker type
Returns
The length of the whisker base type

◆ cats_whisker_decode()

int cats_whisker_decode ( const uint8_t * data,
cats_whisker_t * out )

Decode a whisker from a byte array.

Parameters
dataThe byte array to decode
outThe whisker to write to
Returns
CATS_SUCCESS on success, CATS_FAIL on failure

◆ cats_whisker_encode()

size_t cats_whisker_encode ( const cats_whisker_t * whisker,
uint8_t * out )

Encode a whisker into a byte array.

Parameters
whiskerThe whisker to encode
outThe byte array to write to
Returns
The number of bytes written to out

◆ cats_whisker_new()

cats_whisker_t * cats_whisker_new ( )

Create a new whisker.

Returns
A pointer to the new whisker