diff --git a/src/btstack_defines.h b/src/btstack_defines.h index 681125756..8b9f4c1f4 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -132,6 +132,111 @@ typedef enum { BLE_CHARACTERISTIC_INDICATION_NOT_SUPPORTED } le_command_status_t; +// COMMANDS + +#define OGF_BTSTACK 0x3d + +// cmds for BTstack +// get state: @returns HCI_STATE +#define BTSTACK_GET_STATE 0x01 + +// set power mode: @param HCI_POWER_MODE +#define BTSTACK_SET_POWER_MODE 0x02 + +// set capture mode: @param on +#define BTSTACK_SET_ACL_CAPTURE_MODE 0x03 + +// get BTstack version +#define BTSTACK_GET_VERSION 0x04 + +// get system Bluetooth state +#define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED 0x05 + +// set system Bluetooth state +#define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED 0x06 + +// enable inquiry scan for this client +#define BTSTACK_SET_DISCOVERABLE 0x07 + +// set global Bluetooth state +#define BTSTACK_SET_BLUETOOTH_ENABLED 0x08 + +// create l2cap channel: @param bd_addr(48), psm (16) +#define L2CAP_CREATE_CHANNEL 0x20 + +// disconnect l2cap disconnect, @param channel(16), reason(8) +#define L2CAP_DISCONNECT 0x21 + +// register l2cap service: @param psm(16), mtu (16) +#define L2CAP_REGISTER_SERVICE 0x22 + +// unregister l2cap disconnect, @param psm(16) +#define L2CAP_UNREGISTER_SERVICE 0x23 + +// accept connection @param bd_addr(48), dest cid (16) +#define L2CAP_ACCEPT_CONNECTION 0x24 + +// decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8) +#define L2CAP_DECLINE_CONNECTION 0x25 + +// create l2cap channel: @param bd_addr(48), psm (16), mtu (16) +#define L2CAP_CREATE_CHANNEL_MTU 0x26 + +// register SDP Service Record: service record (size) +#define SDP_REGISTER_SERVICE_RECORD 0x30 + +// unregister SDP Service Record +#define SDP_UNREGISTER_SERVICE_RECORD 0x31 + +// Get remote RFCOMM services +#define SDP_CLIENT_QUERY_RFCOMM_SERVICES 0x32 + +// Get remote SDP services +#define SDP_CLIENT_QUERY_SERVICES 0x33 + +// RFCOMM "HCI" Commands +#define RFCOMM_CREATE_CHANNEL 0x40 +#define RFCOMM_DISCONNECT 0x41 +#define RFCOMM_REGISTER_SERVICE 0x42 +#define RFCOMM_UNREGISTER_SERVICE 0x43 +#define RFCOMM_ACCEPT_CONNECTION 0x44 +#define RFCOMM_DECLINE_CONNECTION 0x45 +#define RFCOMM_PERSISTENT_CHANNEL 0x46 +#define RFCOMM_CREATE_CHANNEL_WITH_CREDITS 0x47 +#define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48 +#define RFCOMM_GRANT_CREDITS 0x49 + +// GAP Classic 0x50 +#define GAP_DISCONNECT 0x50 + +// GAP LE 0x60 +#define GAP_LE_SCAN_START 0x60 +#define GAP_LE_SCAN_STOP 0x61 +#define GAP_LE_CONNECT 0x62 +#define GAP_LE_CONNECT_CANCEL 0x63 +#define GAP_LE_SET_SCAN_PARAMETERS 0x64 + +// GATT (Client) 0x70 +#define GATT_DISCOVER_ALL_PRIMARY_SERVICES 0x70 +#define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16 0x71 +#define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128 0x72 +#define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE 0x73 +#define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE 0x74 +#define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128 0x75 +#define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS 0x76 +#define GATT_READ_VALUE_OF_CHARACTERISTIC 0x77 +#define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC 0x78 +#define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE 0x79 +#define GATT_WRITE_VALUE_OF_CHARACTERISTIC 0x7A +#define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7B +#define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7C +#define GATT_READ_CHARACTERISTIC_DESCRIPTOR 0X7D +#define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR 0X7E +#define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR 0X7F +#define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR 0X80 +#define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION 0X81 +#define GATT_GET_MTU 0x82 + // EVENTS diff --git a/src/hci.h b/src/hci.h index ac691ccaf..0a00ccdb8 100644 --- a/src/hci.h +++ b/src/hci.h @@ -97,109 +97,6 @@ extern "C" { #define HCI_INCOMING_PRE_BUFFER_SIZE 0 #endif -#define OGF_BTSTACK 0x3d - -// cmds for BTstack -// get state: @returns HCI_STATE -#define BTSTACK_GET_STATE 0x01 - -// set power mode: @param HCI_POWER_MODE -#define BTSTACK_SET_POWER_MODE 0x02 - -// set capture mode: @param on -#define BTSTACK_SET_ACL_CAPTURE_MODE 0x03 - -// get BTstack version -#define BTSTACK_GET_VERSION 0x04 - -// get system Bluetooth state -#define BTSTACK_GET_SYSTEM_BLUETOOTH_ENABLED 0x05 - -// set system Bluetooth state -#define BTSTACK_SET_SYSTEM_BLUETOOTH_ENABLED 0x06 - -// enable inquiry scan for this client -#define BTSTACK_SET_DISCOVERABLE 0x07 - -// set global Bluetooth state -#define BTSTACK_SET_BLUETOOTH_ENABLED 0x08 - -// create l2cap channel: @param bd_addr(48), psm (16) -#define L2CAP_CREATE_CHANNEL 0x20 - -// disconnect l2cap disconnect, @param channel(16), reason(8) -#define L2CAP_DISCONNECT 0x21 - -// register l2cap service: @param psm(16), mtu (16) -#define L2CAP_REGISTER_SERVICE 0x22 - -// unregister l2cap disconnect, @param psm(16) -#define L2CAP_UNREGISTER_SERVICE 0x23 - -// accept connection @param bd_addr(48), dest cid (16) -#define L2CAP_ACCEPT_CONNECTION 0x24 - -// decline l2cap disconnect,@param bd_addr(48), dest cid (16), reason(8) -#define L2CAP_DECLINE_CONNECTION 0x25 - -// create l2cap channel: @param bd_addr(48), psm (16), mtu (16) -#define L2CAP_CREATE_CHANNEL_MTU 0x26 - -// register SDP Service Record: service record (size) -#define SDP_REGISTER_SERVICE_RECORD 0x30 - -// unregister SDP Service Record -#define SDP_UNREGISTER_SERVICE_RECORD 0x31 - -// Get remote RFCOMM services -#define SDP_CLIENT_QUERY_RFCOMM_SERVICES 0x32 - -// Get remote SDP services -#define SDP_CLIENT_QUERY_SERVICES 0x33 - -// RFCOMM "HCI" Commands -#define RFCOMM_CREATE_CHANNEL 0x40 -#define RFCOMM_DISCONNECT 0x41 -#define RFCOMM_REGISTER_SERVICE 0x42 -#define RFCOMM_UNREGISTER_SERVICE 0x43 -#define RFCOMM_ACCEPT_CONNECTION 0x44 -#define RFCOMM_DECLINE_CONNECTION 0x45 -#define RFCOMM_PERSISTENT_CHANNEL 0x46 -#define RFCOMM_CREATE_CHANNEL_WITH_CREDITS 0x47 -#define RFCOMM_REGISTER_SERVICE_WITH_CREDITS 0x48 -#define RFCOMM_GRANT_CREDITS 0x49 - -// GAP Classic 0x50 -#define GAP_DISCONNECT 0x50 - -// GAP LE 0x60 -#define GAP_LE_SCAN_START 0x60 -#define GAP_LE_SCAN_STOP 0x61 -#define GAP_LE_CONNECT 0x62 -#define GAP_LE_CONNECT_CANCEL 0x63 -#define GAP_LE_SET_SCAN_PARAMETERS 0x64 - -// GATT (Client) 0x70 -#define GATT_DISCOVER_ALL_PRIMARY_SERVICES 0x70 -#define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID16 0x71 -#define GATT_DISCOVER_PRIMARY_SERVICES_BY_UUID128 0x72 -#define GATT_FIND_INCLUDED_SERVICES_FOR_SERVICE 0x73 -#define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE 0x74 -#define GATT_DISCOVER_CHARACTERISTICS_FOR_SERVICE_BY_UUID128 0x75 -#define GATT_DISCOVER_CHARACTERISTIC_DESCRIPTORS 0x76 -#define GATT_READ_VALUE_OF_CHARACTERISTIC 0x77 -#define GATT_READ_LONG_VALUE_OF_CHARACTERISTIC 0x78 -#define GATT_WRITE_VALUE_OF_CHARACTERISTIC_WITHOUT_RESPONSE 0x79 -#define GATT_WRITE_VALUE_OF_CHARACTERISTIC 0x7A -#define GATT_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7B -#define GATT_RELIABLE_WRITE_LONG_VALUE_OF_CHARACTERISTIC 0x7C -#define GATT_READ_CHARACTERISTIC_DESCRIPTOR 0X7D -#define GATT_READ_LONG_CHARACTERISTIC_DESCRIPTOR 0X7E -#define GATT_WRITE_CHARACTERISTIC_DESCRIPTOR 0X7F -#define GATT_WRITE_LONG_CHARACTERISTIC_DESCRIPTOR 0X80 -#define GATT_WRITE_CLIENT_CHARACTERISTIC_CONFIGURATION 0X81 -#define GATT_GET_MTU 0x82 - // #define IS_COMMAND(packet, command) (READ_BT_16(packet,0) == command.opcode)