Lines Matching +full:sync +full:- +full:gpios
2 * Copyright (c) 2020-2024 Nordic Semiconductor ASA
4 * SPDX-License-Identifier: Apache-2.0
31 static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
51 switch (data->type) { in data_cb()
54 len = MIN(data->data_len, NAME_LEN - 1); in data_cb()
55 memcpy(name, data->data, len); in data_cb()
88 bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); in scan_recv()
92 le_addr, info->adv_type, info->tx_power, info->rssi, name, in scan_recv()
93 (info->adv_props & BT_GAP_ADV_PROP_CONNECTABLE) != 0, in scan_recv()
94 (info->adv_props & BT_GAP_ADV_PROP_SCANNABLE) != 0, in scan_recv()
95 (info->adv_props & BT_GAP_ADV_PROP_DIRECTED) != 0, in scan_recv()
96 (info->adv_props & BT_GAP_ADV_PROP_SCAN_RESPONSE) != 0, in scan_recv()
97 (info->adv_props & BT_GAP_ADV_PROP_EXT_ADV) != 0, in scan_recv()
98 phy2str(info->primary_phy), phy2str(info->secondary_phy), in scan_recv()
99 info->interval, info->interval * 5 / 4, info->sid); in scan_recv()
101 if (!per_adv_found && info->interval) { in scan_recv()
108 interval_us = BT_GAP_PER_ADV_INTERVAL_TO_US(info->interval); in scan_recv()
119 per_sid = info->sid; in scan_recv()
120 bt_addr_le_copy(&per_addr, info->addr); in scan_recv()
130 static void sync_cb(struct bt_le_per_adv_sync *sync, in sync_cb() argument
135 bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); in sync_cb()
139 bt_le_per_adv_sync_get_index(sync), le_addr, in sync_cb()
140 info->interval, info->interval * 5 / 4, phy2str(info->phy)); in sync_cb()
145 static void term_cb(struct bt_le_per_adv_sync *sync, in term_cb() argument
150 bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); in term_cb()
152 printk("PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated\n", in term_cb()
153 bt_le_per_adv_sync_get_index(sync), le_addr); in term_cb()
158 static void recv_cb(struct bt_le_per_adv_sync *sync, in recv_cb() argument
165 bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr)); in recv_cb()
166 bin2hex(buf->data, buf->len, data_str, sizeof(data_str)); in recv_cb()
170 bt_le_per_adv_sync_get_index(sync), le_addr, info->tx_power, in recv_cb()
171 info->rssi, info->cte_type, buf->len, data_str); in recv_cb()
183 struct bt_le_per_adv_sync *sync; in main() local
249 printk("Creating Periodic Advertising Sync..."); in main()
255 err = bt_le_per_adv_sync_create(&sync_create_param, &sync); in main()
262 printk("Waiting for periodic sync...\n"); in main()
267 printk("Deleting Periodic Advertising Sync..."); in main()
268 err = bt_le_per_adv_sync_delete(sync); in main()
275 printk("Periodic sync established.\n"); in main()
286 printk("Waiting for periodic sync lost...\n"); in main()
292 printk("Periodic sync lost.\n"); in main()