Lines Matching full:client

54  *  @brief GATT Client Characteristic Configuration
198 static int filter_set(struct bt_mesh_proxy_client *client, in filter_set() argument
213 memset(client->filter, 0, sizeof(client->filter)); in filter_set()
214 client->filter_type = WHITELIST; in filter_set()
217 memset(client->filter, 0, sizeof(client->filter)); in filter_set()
218 client->filter_type = BLACKLIST; in filter_set()
228 static void filter_add(struct bt_mesh_proxy_client *client, u16_t addr) in filter_add() argument
238 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in filter_add()
239 if (client->filter[i] == addr) { in filter_add()
244 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in filter_add()
245 if (client->filter[i] == BT_MESH_ADDR_UNASSIGNED) { in filter_add()
246 client->filter[i] = addr; in filter_add()
252 static void filter_remove(struct bt_mesh_proxy_client *client, u16_t addr) in filter_remove() argument
262 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in filter_remove()
263 if (client->filter[i] == addr) { in filter_remove()
264 client->filter[i] = BT_MESH_ADDR_UNASSIGNED; in filter_remove()
270 static void send_filter_status(struct bt_mesh_proxy_client *client, in send_filter_status() argument
289 if (client->filter_type == WHITELIST) { in send_filter_status()
295 for (filter_size = 0, i = 0; i < ARRAY_SIZE(client->filter); i++) { in send_filter_status()
296 if (client->filter[i] != BT_MESH_ADDR_UNASSIGNED) { in send_filter_status()
311 err = proxy_segment_and_send(client->conn_handle, BT_MESH_PROXY_CONFIG, buf); in send_filter_status()
317 static void proxy_cfg(struct bt_mesh_proxy_client *client) in proxy_cfg() argument
324 err = bt_mesh_net_decode(client->buf, BT_MESH_NET_IF_PROXY_CFG, in proxy_cfg()
344 filter_set(client, buf); in proxy_cfg()
345 send_filter_status(client, &rx, buf); in proxy_cfg()
352 filter_add(client, addr); in proxy_cfg()
354 send_filter_status(client, &rx, buf); in proxy_cfg()
361 filter_remove(client, addr); in proxy_cfg()
363 send_filter_status(client, &rx, buf); in proxy_cfg()
389 struct bt_mesh_proxy_client *client; in proxy_send_beacons() local
393 client = ble_npl_event_get_arg(work); in proxy_send_beacons()
399 beacon_send(client->conn_handle, sub); in proxy_send_beacons()
475 static void proxy_complete_pdu(struct bt_mesh_proxy_client *client) in proxy_complete_pdu() argument
477 switch (client->msg_type) { in proxy_complete_pdu()
481 bt_mesh_net_recv(client->buf, 0, BT_MESH_NET_IF_PROXY); in proxy_complete_pdu()
485 bt_mesh_beacon_recv(client->buf); in proxy_complete_pdu()
489 proxy_cfg(client); in proxy_complete_pdu()
495 bt_mesh_pb_gatt_recv(client->conn_handle, client->buf); in proxy_complete_pdu()
499 BT_WARN("Unhandled Message Type 0x%02x", client->msg_type); in proxy_complete_pdu()
503 net_buf_simple_init(client->buf, 0); in proxy_complete_pdu()
509 struct bt_mesh_proxy_client *client; in proxy_recv() local
513 client = find_client(conn_handle); in proxy_recv()
515 if (!client) { in proxy_recv()
530 if (len - 1 > net_buf_simple_tailroom(client->buf)) { in proxy_recv()
537 if (client->buf->om_len) { in proxy_recv()
542 client->msg_type = PDU_TYPE(data); in proxy_recv()
543 net_buf_simple_add_mem(client->buf, data + 1, len - 1); in proxy_recv()
544 proxy_complete_pdu(client); in proxy_recv()
548 if (client->buf->om_len) { in proxy_recv()
553 client->msg_type = PDU_TYPE(data); in proxy_recv()
554 net_buf_simple_add_mem(client->buf, data + 1, len - 1); in proxy_recv()
558 if (!client->buf->om_len) { in proxy_recv()
563 if (client->msg_type != PDU_TYPE(data)) { in proxy_recv()
568 net_buf_simple_add_mem(client->buf, data + 1, len - 1); in proxy_recv()
572 if (!client->buf->om_len) { in proxy_recv()
577 if (client->msg_type != PDU_TYPE(data)) { in proxy_recv()
582 net_buf_simple_add_mem(client->buf, data + 1, len - 1); in proxy_recv()
583 proxy_complete_pdu(client); in proxy_recv()
594 struct bt_mesh_proxy_client *client; in proxy_connected() local
609 for (client = NULL, i = 0; i < ARRAY_SIZE(clients); i++) { in proxy_connected()
611 client = &clients[i]; in proxy_connected()
616 if (!client) { in proxy_connected()
617 BT_ERR("No free Proxy Client objects"); in proxy_connected()
621 client->conn_handle = conn_handle; in proxy_connected()
622 client->filter_type = NONE; in proxy_connected()
623 memset(client->filter, 0, sizeof(client->filter)); in proxy_connected()
624 net_buf_simple_init(client->buf, 0); in proxy_connected()
636 struct bt_mesh_proxy_client *client = &clients[i]; in proxy_disconnected() local
638 if (client->conn_handle == conn_handle) { in proxy_disconnected()
640 client->filter_type == PROV) { in proxy_disconnected()
644 client->conn_handle = 0; in proxy_disconnected()
664 struct bt_mesh_proxy_client *client; in prov_ccc_write() local
668 /* If a connection exists there must be a client */ in prov_ccc_write()
669 client = find_client(conn_handle); in prov_ccc_write()
670 __ASSERT(client, "No client for connection"); in prov_ccc_write()
672 if (client->filter_type == NONE) { in prov_ccc_write()
673 client->filter_type = PROV; in prov_ccc_write()
722 struct bt_mesh_proxy_client *client = &clients[i]; in bt_mesh_proxy_prov_disable() local
724 if (clients->conn_handle && client->filter_type == PROV) { in bt_mesh_proxy_prov_disable()
725 bt_mesh_pb_gatt_close(client->conn_handle); in bt_mesh_proxy_prov_disable()
726 client->filter_type = NONE; in bt_mesh_proxy_prov_disable()
737 struct bt_mesh_proxy_client *client; in proxy_ccc_write() local
741 client = find_client(conn_handle); in proxy_ccc_write()
742 __ASSERT(client, "No client for connection"); in proxy_ccc_write()
744 if (client->filter_type == NONE) { in proxy_ccc_write()
745 client->filter_type = WHITELIST; in proxy_ccc_write()
746 k_work_add_arg(&client->send_beacons, client); in proxy_ccc_write()
747 k_work_submit(&client->send_beacons); in proxy_ccc_write()
784 struct bt_mesh_proxy_client *client = &clients[i]; in bt_mesh_proxy_gatt_disconnect() local
786 if (client->conn_handle && (client->filter_type == WHITELIST || in bt_mesh_proxy_gatt_disconnect()
787 client->filter_type == BLACKLIST)) { in bt_mesh_proxy_gatt_disconnect()
788 client->filter_type = NONE; in bt_mesh_proxy_gatt_disconnect()
789 rc = ble_gap_terminate(client->conn_handle, in bt_mesh_proxy_gatt_disconnect()
818 struct bt_mesh_proxy_client *client = NULL; in bt_mesh_proxy_addr_add() local
822 client = &clients[i]; in bt_mesh_proxy_addr_add()
823 if (client->buf == buf) { in bt_mesh_proxy_addr_add()
828 assert(client); in bt_mesh_proxy_addr_add()
830 BT_DBG("filter_type %u addr 0x%04x", client->filter_type, addr); in bt_mesh_proxy_addr_add()
832 if (client->filter_type == WHITELIST) { in bt_mesh_proxy_addr_add()
833 filter_add(client, addr); in bt_mesh_proxy_addr_add()
834 } else if (client->filter_type == BLACKLIST) { in bt_mesh_proxy_addr_add()
835 filter_remove(client, addr); in bt_mesh_proxy_addr_add()
839 static bool client_filter_match(struct bt_mesh_proxy_client *client, in client_filter_match() argument
844 BT_DBG("filter_type %u addr 0x%04x", client->filter_type, addr); in client_filter_match()
846 if (client->filter_type == WHITELIST) { in client_filter_match()
847 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in client_filter_match()
848 if (client->filter[i] == addr) { in client_filter_match()
856 if (client->filter_type == BLACKLIST) { in client_filter_match()
857 for (i = 0; i < ARRAY_SIZE(client->filter); i++) { in client_filter_match()
858 if (client->filter[i] == addr) { in client_filter_match()
877 struct bt_mesh_proxy_client *client = &clients[i]; in bt_mesh_proxy_relay() local
880 if (!client->conn_handle) { in bt_mesh_proxy_relay()
884 if (!client_filter_match(client, dst)) { in bt_mesh_proxy_relay()
895 bt_mesh_proxy_send(client->conn_handle, BT_MESH_PROXY_NET_PDU, msg); in bt_mesh_proxy_relay()
967 struct bt_mesh_proxy_client *client = find_client(conn_handle); in bt_mesh_proxy_send() local
969 if (!client) { in bt_mesh_proxy_send()
970 BT_ERR("No Proxy Client found"); in bt_mesh_proxy_send()
974 if ((client->filter_type == PROV) != (type == BT_MESH_PROXY_PROV)) { in bt_mesh_proxy_send()
975 BT_ERR("Invalid PDU type for Proxy Client"); in bt_mesh_proxy_send()