1 /* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of the copyright holders nor the names of 14 * contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 4. Any redistribution, use, or modification is done solely for 17 * personal benefit and not for any commercial purpose or for 18 * monetary gain. 19 * 20 * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 24 * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 26 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 27 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 30 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * Please inquire about commercial licensing options at 34 * [email protected] 35 * 36 */ 37 38 // ***************************************************************************** 39 // 40 // HFP Test Sequences 41 // 42 // ***************************************************************************** 43 44 #include <stdint.h> 45 #include <stdio.h> 46 #include <stdlib.h> 47 #include <string.h> 48 49 #include "test_sequences.h" 50 51 52 #define TEST_SEQUENCE(name) { (char**)name, sizeof(name) / sizeof(char *)} 53 54 /* Service Level Connection (slc) test sequences */ 55 56 const char * slc_test1[] = { 57 "AT+BRSF=438", 58 "+BRSF:1007", 59 "OK", 60 "AT+BAC=1,2", 61 "OK", 62 "AT+CIND=?", 63 "+CIND:(\"service\",(0,1)),(\"call\",(0,1)),(\"callsetup\",(0,3)),(\"battchg\",(0,5)),(\"signal\",(0,5)),(\"roam\",(0,1)),(\"callheld\",(0,2))", 64 "OK", 65 "AT+CIND?", 66 "+CIND:1,0,0,3,5,0,0", 67 "OK", 68 "AT+CMER=3,0,0,1", 69 "OK", 70 "AT+CHLD=?", 71 "+CHLD:(1,1x,2,2x,3)", 72 "OK" 73 }; 74 75 hfp_test_item_t slc_tests[] = { 76 TEST_SEQUENCE(slc_test1) 77 }; 78 79 /* Service Level Connection (slc) common commands */ 80 const char * slc_cmds_test1[] = { 81 "AT+BAC=1,3", 82 "OK" 83 }; 84 85 hfp_test_item_t slc_cmds_tests[] = { 86 TEST_SEQUENCE(slc_cmds_test1) 87 }; 88 /* Codecs Connection (cc) test sequences */ 89 90 const char * cc_test1[] = { 91 "AT+BCC", 92 "OK", 93 "+BCS:1", 94 "AT+BCS=1", 95 "OK" 96 }; 97 98 const char * cc_test2[] = { 99 "AT+BCC", 100 "OK", 101 "+BCS:1", 102 "AT+BAC=2,3", 103 "OK", 104 "+BCS:2", 105 "AT+BCS=2", 106 "OK" 107 }; 108 109 hfp_test_item_t cc_tests[] = { 110 TEST_SEQUENCE(cc_test1), 111 TEST_SEQUENCE(cc_test2) 112 }; 113 114 115 116 ////////////// 117 118 int test_item_size = sizeof(hfp_test_item_t); 119 120 // SLC 121 hfp_test_item_t * hfp_slc_tests(){ 122 return slc_tests; 123 } 124 125 int slc_tests_size(){ 126 return sizeof(slc_tests)/test_item_size; 127 } 128 129 char ** default_slc_setup(){ 130 return (char **)slc_test1; 131 } 132 133 int default_slc_setup_size(){ 134 return sizeof(slc_test1)/sizeof(char*); 135 } 136 137 // CC 138 hfp_test_item_t * hfp_cc_tests(){ 139 return cc_tests; 140 } 141 int cc_tests_size(){ 142 return sizeof(cc_tests) /test_item_size; 143 } 144 char ** default_cc_setup(){ 145 return (char **)cc_test1; 146 } 147 int default_cc_setup_size(){ 148 return sizeof(cc_test1)/sizeof(char*); 149 } 150