|
23 | 23 | #define H_BLE_CS_ |
24 | 24 | #include "syscfg/syscfg.h" |
25 | 25 |
|
| 26 | +#define BLE_HS_CS_MODE0 (0) |
| 27 | +#define BLE_HS_CS_MODE1 (1) |
| 28 | +#define BLE_HS_CS_MODE2 (2) |
| 29 | +#define BLE_HS_CS_MODE3 (3) |
| 30 | +#define BLE_HS_CS_MODE_UNUSED (0xff) |
| 31 | +#define BLE_HS_CS_SUBMODE_TYPE BLE_HS_CS_MODE_UNUSED |
| 32 | + |
| 33 | +#define BLE_HS_CS_ROLE_INITIATOR (0) |
| 34 | +#define BLE_HS_CS_ROLE_REFLECTOR (1) |
| 35 | + |
26 | 36 | #define BLE_CS_EVENT_CS_PROCEDURE_COMPLETE (0) |
| 37 | +#define BLE_CS_EVENT_CS_STEP_DATA (1) |
| 38 | + |
| 39 | +#define BLE_HS_CS_TOA_TOD_NOT_AVAILABLE (0x00008000) |
| 40 | +#define BLE_HS_CS_N_AP_MAX (4) |
| 41 | + |
| 42 | +struct ble_cs_mode0_result { |
| 43 | + uint16_t measured_freq_offset; |
| 44 | + uint8_t packet_quality; |
| 45 | + uint8_t packet_rssi; |
| 46 | + uint8_t packet_antenna; |
| 47 | + uint8_t step_channel; |
| 48 | +}; |
| 49 | + |
| 50 | +struct ble_cs_mode1_result { |
| 51 | + uint32_t packet_pct1; |
| 52 | + uint32_t packet_pct2; |
| 53 | + int16_t toa_tod; |
| 54 | + uint8_t packet_quality; |
| 55 | + uint8_t packet_nadm; |
| 56 | + uint8_t packet_rssi; |
| 57 | + uint8_t packet_antenna; |
| 58 | + uint8_t step_channel; |
| 59 | +}; |
| 60 | + |
| 61 | +struct ble_cs_mode2_result { |
| 62 | + uint32_t tone_pct[BLE_HS_CS_N_AP_MAX + 1]; |
| 63 | + uint8_t tone_quality_ind[BLE_HS_CS_N_AP_MAX + 1]; |
| 64 | + uint8_t antenna_paths[4]; |
| 65 | + uint8_t antenna_path_permutation_id; |
| 66 | + uint8_t step_channel; |
| 67 | +}; |
| 68 | + |
| 69 | +struct ble_cs_mode3_result { |
| 70 | + uint32_t packet_pct1; |
| 71 | + uint32_t packet_pct2; |
| 72 | + uint32_t tone_pct[BLE_HS_CS_N_AP_MAX + 1]; |
| 73 | + uint8_t tone_quality_ind[BLE_HS_CS_N_AP_MAX + 1]; |
| 74 | + uint8_t antenna_paths[4]; |
| 75 | + int16_t toa_tod; |
| 76 | + uint8_t antenna_path_permutation_id; |
| 77 | + uint8_t packet_quality; |
| 78 | + uint8_t packet_nadm; |
| 79 | + uint8_t packet_rssi; |
| 80 | + uint8_t packet_antenna; |
| 81 | + uint8_t step_channel; |
| 82 | +}; |
27 | 83 |
|
28 | 84 | struct ble_cs_event { |
| 85 | + uint16_t conn_handle; |
| 86 | + uint8_t status; |
29 | 87 | uint8_t type; |
30 | | - union |
31 | | - { |
32 | | - struct |
33 | | - { |
34 | | - uint16_t conn_handle; |
35 | | - uint8_t status; |
36 | | - } procedure_complete; |
| 88 | + union { |
| 89 | + struct { |
| 90 | + uint8_t role; |
| 91 | + uint8_t mode; |
| 92 | + uint8_t *data; |
| 93 | + } step_data; |
37 | 94 | }; |
38 | | - |
39 | 95 | }; |
40 | 96 |
|
41 | 97 | typedef int ble_cs_event_fn(struct ble_cs_event *event, void *arg); |
42 | 98 |
|
43 | | -struct ble_cs_initiator_procedure_start_params { |
| 99 | +struct ble_cs_procedure_start_params { |
44 | 100 | uint16_t conn_handle; |
45 | | - ble_cs_event_fn *cb; |
46 | | - void *cb_arg; |
47 | 101 | }; |
48 | 102 |
|
49 | | -struct ble_cs_reflector_setup_params { |
| 103 | +struct ble_cs_setup_params { |
| 104 | + uint16_t conn_handle; |
50 | 105 | ble_cs_event_fn *cb; |
51 | 106 | void *cb_arg; |
| 107 | + uint8_t local_role; |
52 | 108 | }; |
53 | 109 |
|
54 | | -int ble_cs_initiator_procedure_start(const struct ble_cs_initiator_procedure_start_params *params); |
55 | | -int ble_cs_initiator_procedure_terminate(uint16_t conn_handle); |
56 | | -int ble_cs_reflector_setup(struct ble_cs_reflector_setup_params *params); |
| 110 | +int ble_cs_procedure_start(const struct ble_cs_procedure_start_params *params); |
| 111 | +int ble_cs_procedure_terminate(uint16_t conn_handle); |
| 112 | +int ble_cs_setup(struct ble_cs_setup_params *params); |
57 | 113 | #endif |
0 commit comments