1 /* -*- c -*- */
2 /*
3 * Copyright 2012 Dominic Spill
4 *
5 * This file is part of libbtbb
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with libbtbb; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22 /*
23 UAP Data HEC Header (octal)
24 ----------------------------------
25 00 123 e1 770007 007070 000777
26 47 123 06 770007 007007 700000
27 00 124 32 007007 007007 007700
28 47 124 d5 007007 007070 707077
29 00 125 5a 707007 007007 077070
30 47 125 bd 707007 007070 777707
31 00 126 e2 077007 007007 000777
32 47 126 05 077007 007070 700000
33 00 127 8a 777007 007007 070007
34 47 127 6d 777007 007070 770770
35 00 11b 9e 770770 007007 777007
36 47 11b 79 770770 007070 077770
37 00 11c 4d 007770 007070 770070
38 47 11c aa 007770 007007 070707
39 00 11d 25 707770 007070 700700
40 47 11d c2 707770 007007 000077
41 00 11e 9d 077770 007070 777007
42 47 11e 7a 077770 007007 077770
43 00 11f f5 777770 007070 707777
44 47 11f 12 777770 007007 007000
45 */
46
47 #include "../bluetooth_packet_tx.h"
48 #include <stdio.h>
49
test_gen_packet_header()50 int test_gen_packet_header() {
51 char *optr;
52 int i, j, ret, err;
53 ret = 0;
54
55 printf("Testing header\n");
56 printf("---------------\n");
57
58 /* lt_addr, type, flow, arqn, seqn, UAP, HEC */
59 uint8_t data[20][7] = {
60 {},
61 {},
62 {},
63 {},
64 {},
65 {},
66 {},
67 {},
68 {},
69 {}
70 UAP Data HE
71 -----------
72 00 123 e1
73 47 123 06
74 00 124 32
75 47 124 d5
76 00 125 5a
77 47 125 bd
78 00 126 e2
79 47 126 05
80 00 127 8a
81 47 127 6d
82 00 11b 9e
83 47 11b 79
84 00 11c 4d
85 47 11c aa
86 00 11d 25
87 47 11d c2
88 00 11e 9d
89 47 11e 7a
90 00 11f f5
91 47 11f 12
92
93 };
94
95 for(i = 0; i < 20; i++) {
96 gen_packet_header(uint8_t lt_addr, uint8_t type, uint8_t flow, uint8_t arqn, uint8_t seqn)
97 if (uap == 1) {
98 printf("E");
99 ret++;
100 }
101 else
102 printf(".");
103 }
104
105 if (ret > 0)
106 printf("%d errors\n", ret);
107 printf("\n--------------------\n");
108 printf("Done testing unfec23\n");
109 return ret;
110 }
111
main(int argc,char ** argv)112 int main(int argc, char** argv) {
113 int ret = 0;
114
115 ret += test_unfec23();
116
117 exit(ret);
118 }
119