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 #ifndef H_BLE_HS_PERIODIC_SYNC_ 21 #define H_BLE_HS_PERIODIC_SYNC_ 22 23 #include <stdint.h> 24 #include "os/queue.h" 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 struct ble_hs_periodic_sync { 30 SLIST_ENTRY(ble_hs_periodic_sync) next; 31 uint16_t sync_handle; 32 ble_addr_t advertiser_addr; 33 uint8_t adv_sid; 34 35 ble_gap_event_fn *cb; 36 void *cb_arg; 37 38 struct ble_npl_event lost_ev; 39 }; 40 41 struct ble_hs_periodic_sync *ble_hs_periodic_sync_alloc(void); 42 void ble_hs_periodic_sync_free(struct ble_hs_periodic_sync *psync); 43 void ble_hs_periodic_sync_insert(struct ble_hs_periodic_sync *psync); 44 void ble_hs_periodic_sync_remove(struct ble_hs_periodic_sync *psync); 45 struct ble_hs_periodic_sync *ble_hs_periodic_sync_find_by_handle(uint16_t sync_handle); 46 struct ble_hs_periodic_sync *ble_hs_periodic_sync_find(const ble_addr_t *addr, uint8_t sid); 47 struct ble_hs_periodic_sync *ble_hs_periodic_sync_first(void); 48 int ble_hs_periodic_sync_init(void); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif