summaryrefslogtreecommitdiff
path: root/rpack.h
blob: d972a5400fa76fef99eb5f94f2527dca4024585f (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

/*------------------------------------------------------------------
 *
 * File:        rpack.h
 *
 * Purpose:   	Definition of Garmin Rino message format.
 *		
 * References:	http://www.radio-active.net.au/web3/APRS/Resources/RINO
 *
 *		http://www.radio-active.net.au/web3/APRS/Resources/RINO/OnAir
 *
 *---------------------------------------------------------------*/


#ifndef RPACK_H
#define RPACK_H 1


#define RPACK_FRAME_LEN 168


#ifdef RPACK_C		/* Expose private details */


 
// Transmission order is LSB first. 

struct __attribute__((__packed__)) rpack_s {

	int lat;		// Latitude.
				// Signed integer.  Scaled by 2**30/90.

	int lon;		// Longitude.  Same encoding.

	char unknown1;		// Unproven theory: altitude.	
	char unknown2;		

	unsigned name0:6;	// 10 character name.
	unsigned name1:6;	// Bit packing is implementation dependent.
	unsigned name2:6;	// Should rewrite to be more portable.
	unsigned name3:6;
	unsigned name4:6;
	unsigned name5:6;
	unsigned name6:6;
	unsigned name7:6;
	unsigned name8:6;
	unsigned name9:6;

	unsigned symbol:5;	

	unsigned unknown3:7;		
				
	
//	unsigned crc:16;	// Safe bet this is CRC for error checking.

	unsigned char crc1;
	unsigned char crc2;

	char dummy[3];		// Total size should be 24 bytes if no gaps.

};

#else			/* Show only public interface.  */


struct rpack_s {
	char stuff[24];
};


#endif



void rpack_set_bit (struct rpack_s *rp, int position, int value);

int rpack_is_valid (struct rpack_s *rp);

int rpack_get_bit (struct rpack_s *rp, int position);

double rpack_get_lat (struct rpack_s *rp);

double rpack_get_lon (struct rpack_s *rp);

int rpack_get_symbol (struct rpack_s *rp);

void rpack_get_name (struct rpack_s *rp, char *str);



#endif

/* end rpack.h */