|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +/* btp_gatts.h - Bluetooth tester GATT Server service headers */ |
| 21 | + |
| 22 | +/* |
| 23 | + * Copyright (c) 2015-2016 Intel Corporation |
| 24 | + * Copyright (C) 2025 Codecoup |
| 25 | + * |
| 26 | + * SPDX-License-Identifier: Apache-2.0 |
| 27 | + */ |
| 28 | + |
| 29 | +/* GATT Server Service */ |
| 30 | +#define BTP_GATT_HL_MAX_CNT 16 |
| 31 | +struct btp_notify_hlv { |
| 32 | + uint16_t handle; |
| 33 | + uint16_t len; |
| 34 | +}; |
| 35 | +/* commands */ |
| 36 | +#define BTP_GATTS_READ_SUPPORTED_COMMANDS 0x01 |
| 37 | +struct btp_gatts_read_supported_commands_rp { |
| 38 | + uint8_t data[0]; |
| 39 | +} __packed; |
| 40 | + |
| 41 | +/* TODO: this should be renamed to SVC_CHANGE? */ |
| 42 | +#define BTP_GATTS_START_SERVER 0x07 |
| 43 | +struct btp_gatts_start_server_rp { |
| 44 | + uint16_t db_attr_off; |
| 45 | + uint8_t db_attr_cnt; |
| 46 | +} __packed; |
| 47 | + |
| 48 | +#define BTP_GATTS_GET_ATTRIBUTES 0x02 |
| 49 | +struct btp_gatts_get_attributes_cmd { |
| 50 | + uint16_t start_handle; |
| 51 | + uint16_t end_handle; |
| 52 | + uint8_t type_length; |
| 53 | + uint8_t type[0]; |
| 54 | +} __packed; |
| 55 | +struct btp_gatts_get_attributes_rp { |
| 56 | + uint8_t attrs_count; |
| 57 | + uint8_t attrs[0]; |
| 58 | +} __packed; |
| 59 | +struct btp_gatts_attr { |
| 60 | + uint16_t handle; |
| 61 | + uint8_t permission; |
| 62 | + uint8_t type_length; |
| 63 | + uint8_t type[0]; |
| 64 | +} __packed; |
| 65 | + |
| 66 | +#define BTP_GATTS_GET_ATTRIBUTE_VALUE 0x03 |
| 67 | +struct btp_gatts_get_attribute_value_cmd { |
| 68 | + ble_addr_t address; |
| 69 | + uint16_t handle; |
| 70 | +} __packed; |
| 71 | +struct btp_gatts_get_attribute_value_rp { |
| 72 | + uint8_t att_response; |
| 73 | + uint16_t value_length; |
| 74 | + uint8_t value[0]; |
| 75 | +} __packed; |
| 76 | + |
| 77 | +#define BTP_GATTS_SET_VALUE 0x04 |
| 78 | +struct btp_gatts_set_value_cmd { |
| 79 | + uint16_t attr_id; |
| 80 | + uint16_t len; |
| 81 | + uint8_t value[0]; |
| 82 | +} __packed; |
| 83 | + |
| 84 | +#define BTP_GATTS_SET_MULT_VALUE 0x22 |
| 85 | +struct btp_gatts_set_mult_val_cmd { |
| 86 | + ble_addr_t address; |
| 87 | + uint16_t count; |
| 88 | + struct btp_notify_hlv hl[BTP_GATT_HL_MAX_CNT]; |
| 89 | + uint8_t value[0]; |
| 90 | +} __packed; |
| 91 | + |
| 92 | +#define BTP_GATTS_CHANGE_DATABASE 0x05 |
| 93 | +struct btp_gatts_change_database_cmd { |
| 94 | + uint16_t start_handle; |
| 95 | + uint16_t end_handle; |
| 96 | + uint8_t visibility; |
| 97 | +} __packed; |
| 98 | + |
| 99 | +/* GATTS events */ |
| 100 | +#define BTP_GATTS_EV_ATTR_VALUE_CHANGED 0x81 |
| 101 | +struct btp_gatts_attr_value_changed_ev { |
| 102 | + uint16_t handle; |
| 103 | + uint16_t data_length; |
| 104 | + uint8_t data[0]; |
| 105 | +} __packed; |
0 commit comments