1 /* 2 * Copyright 2016-2023, Cypress Semiconductor Corporation or 3 * an affiliate of Cypress Semiconductor Corporation. All rights reserved. 4 * 5 * This software, including source code, documentation and related 6 * materials ("Software") is owned by Cypress Semiconductor Corporation 7 * or one of its affiliates ("Cypress") and is protected by and subject to 8 * worldwide patent protection (United States and foreign), 9 * United States copyright laws and international treaty provisions. 10 * Therefore, you may use this Software only as provided in the license 11 * agreement accompanying the software package from which you 12 * obtained this Software ("EULA"). 13 * If no EULA applies, Cypress hereby grants you a personal, non-exclusive, 14 * non-transferable license to copy, modify, and compile the Software 15 * source code solely for use in connection with Cypress's 16 * integrated circuit products. Any reproduction, modification, translation, 17 * compilation, or representation of this Software except as specified 18 * above is prohibited without the express written permission of Cypress. 19 * 20 * Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND, 21 * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress 23 * reserves the right to make changes to the Software without notice. Cypress 24 * does not assume any liability arising out of the application or use of the 25 * Software or any product or circuit described in the Software. Cypress does 26 * not authorize its products for use in any products where a malfunction or 27 * failure of the Cypress product may reasonably be expected to result in 28 * significant property damage, injury or death ("High Risk Product"). By 29 * including Cypress's product in a High Risk Product, the manufacturer 30 * of such system or application assumes all risk of such use and in doing 31 * so agrees to indemnify Cypress against all liability. 32 */ 33 34 /** @file 35 * Defines common constants and types for the WICED Bluetooth Framework 36 */ 37 38 #pragma once 39 40 #include "wiced_bt_version.h" 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /****************************************************** 47 * Macros 48 ******************************************************/ 49 50 #ifndef RESULT_ENUM 51 /** Result Enum*/ 52 #define RESULT_ENUM( prefix, name, value ) prefix ## name = (value) 53 #endif /* ifndef RESULT_ENUM */ 54 55 /* BT Result List*/ 56 #define BT_RESULT_LIST( prefix ) \ 57 RESULT_ENUM( prefix, SUCCESS, 0 ), /**< Success */ \ 58 RESULT_ENUM( prefix, PARTIAL_RESULTS, 3 ), /**< Partial results */ \ 59 RESULT_ENUM( prefix, BADARG, 5 ), /**< Bad Arguments */ \ 60 RESULT_ENUM( prefix, BADOPTION, 6 ), /**< Mode not supported */ \ 61 RESULT_ENUM( prefix, OUT_OF_HEAP_SPACE, 8 ), /**< Dynamic memory space exhausted */ \ 62 RESULT_ENUM( prefix, UNKNOWN_EVENT, 8029 ), /**< Unknown event is received */ \ 63 RESULT_ENUM( prefix, LIST_EMPTY, 8010 ), /**< List is empty */ \ 64 RESULT_ENUM( prefix, ITEM_NOT_IN_LIST, 8011 ), /**< Item not found in the list */ \ 65 RESULT_ENUM( prefix, PACKET_DATA_OVERFLOW, 8012 ), /**< Data overflow beyond the packet end */ \ 66 RESULT_ENUM( prefix, PACKET_POOL_EXHAUSTED, 8013 ), /**< All packets in the pool is in use */ \ 67 RESULT_ENUM( prefix, PACKET_POOL_FATAL_ERROR, 8014 ), /**< Packet pool fatal error such as permanent packet leak */ \ 68 RESULT_ENUM( prefix, UNKNOWN_PACKET, 8015 ), /**< Unknown packet */ \ 69 RESULT_ENUM( prefix, PACKET_WRONG_OWNER, 8016 ), /**< Packet is owned by another entity */ \ 70 RESULT_ENUM( prefix, BUS_UNINITIALISED, 8017 ), /**< Bluetooth bus isn't initialised */ \ 71 RESULT_ENUM( prefix, MPAF_UNINITIALISED, 8018 ), /**< MPAF framework isn't initialised */ \ 72 RESULT_ENUM( prefix, RFCOMM_UNINITIALISED, 8019 ), /**< RFCOMM protocol isn't initialised */ \ 73 RESULT_ENUM( prefix, STACK_UNINITIALISED, 8020 ), /**< SmartBridge isn't initialised */ \ 74 RESULT_ENUM( prefix, SMARTBRIDGE_UNINITIALISED, 8021 ), /**< Bluetooth stack isn't initialised */ \ 75 RESULT_ENUM( prefix, ATT_CACHE_UNINITIALISED, 8022 ), /**< Attribute cache isn't initialised */ \ 76 RESULT_ENUM( prefix, MAX_CONNECTIONS_REACHED, 8023 ), /**< Maximum number of connections is reached */ \ 77 RESULT_ENUM( prefix, SOCKET_IN_USE, 8024 ), /**< Socket specified is in use */ \ 78 RESULT_ENUM( prefix, SOCKET_NOT_CONNECTED, 8025 ), /**< Socket is not connected or connection failed */ \ 79 RESULT_ENUM( prefix, ENCRYPTION_FAILED, 8026 ), /**< Encryption failed */ \ 80 RESULT_ENUM( prefix, SCAN_IN_PROGRESS, 8027 ), /**< Scan is in progress */ \ 81 RESULT_ENUM( prefix, CONNECT_IN_PROGRESS, 8028 ), /**< Connect is in progress */ \ 82 RESULT_ENUM( prefix, DISCONNECT_IN_PROGRESS, 8029 ), /**< Disconnect is in progress */ \ 83 RESULT_ENUM( prefix, DISCOVER_IN_PROGRESS, 8030 ), /**< Discovery is in progress */ \ 84 RESULT_ENUM( prefix, GATT_TIMEOUT, 8031 ), /**< GATT timeout occured*/ \ 85 RESULT_ENUM( prefix, ATTRIBUTE_VALUE_TOO_LONG, 8032 ), /**< Attribute value too long */ \ 86 RESULT_ENUM( prefix, PENDING, 8100 ), /**< Pending */ \ 87 RESULT_ENUM( prefix, BUSY, 8101 ), /**< Device busy with another command */ \ 88 RESULT_ENUM( prefix, NO_RESOURCES, 8102 ), /**< No resources to issue command */ \ 89 RESULT_ENUM( prefix, UNSUPPORTED, 8103 ), /**< Unsupported function */ \ 90 RESULT_ENUM( prefix, ILLEGAL_VALUE, 8104 ), /**< Illegal parameter value */ \ 91 RESULT_ENUM( prefix, WRONG_MODE, 8105 ), /**< Device in wrong mode for request */ \ 92 RESULT_ENUM( prefix, UNKNOWN_ADDR, 8106 ), /**< Unknown remote BD address */ \ 93 RESULT_ENUM( prefix, TIMEOUT, 8107 ), /**< Timeout */ \ 94 RESULT_ENUM( prefix, BAD_VALUE_RET, 8108 ), /**< A bad value was received from HCI */ \ 95 RESULT_ENUM( prefix, ERROR, 8109 ), /**< Error */ \ 96 RESULT_ENUM( prefix, NOT_AUTHORIZED, 8110 ), /**< Authorization failed */ \ 97 RESULT_ENUM( prefix, DEV_RESET, 8111 ), /**< Device has been reset */ \ 98 RESULT_ENUM( prefix, CMD_STORED, 8112 ), /**< request is stored in control block */ \ 99 RESULT_ENUM( prefix, ILLEGAL_ACTION, 8113 ), /**< state machine gets illegal command */ \ 100 RESULT_ENUM( prefix, DELAY_CHECK, 8114 ), /**< delay the check on encryption */ \ 101 RESULT_ENUM( prefix, SCO_BAD_LENGTH, 8115 ), /**< Bad SCO over HCI data length */ \ 102 RESULT_ENUM( prefix, SUCCESS_NO_SECURITY, 8116 ), /**< security passed, no security set */ \ 103 RESULT_ENUM( prefix, FAILED_ON_SECURITY, 8117 ), /**< security failed */ \ 104 RESULT_ENUM( prefix, REPEATED_ATTEMPTS, 8118 ), /**< repeated attempts for LE security requests */ \ 105 RESULT_ENUM( prefix, MODE4_LEVEL4_NOT_SUPPORTED,8119 ), /**< Connections Only Mode can't be supported */ \ 106 RESULT_ENUM( prefix, USE_DEFAULT_SECURITY, 8120 ), /**< Use default security */ \ 107 RESULT_ENUM( prefix, KEY_MISSING, 8121 ), /**< Key Missing */ \ 108 RESULT_ENUM( prefix, ENCRYPT_DISABLED, 8122 ), /**< Encryption is disabled */ \ 109 RESULT_ENUM( prefix, SERVICE_NOT_FOUND, 8123 ), /**< Service not found */ 110 111 112 /****************************************************** 113 * Constants 114 ******************************************************/ 115 116 /** @cond !ADDTHIS*/ 117 #define WICED_BT_ADDRESS_BYTE_SIZE 6 /**< BT Address size */ 118 /** @endcond */ 119 120 /****************************************************** 121 * Enumerations 122 ******************************************************/ 123 124 125 126 /****************************************************** 127 * Type Definitions 128 ******************************************************/ 129 130 /****************************************************** 131 * Structures 132 ******************************************************/ 133 134 135 /****************************************************** 136 * Global Variables 137 ******************************************************/ 138 139 /****************************************************** 140 * Function Declarations 141 ******************************************************/ 142 143 #ifdef __cplusplus 144 } /* extern "C" */ 145 #endif 146