hci.c (07e010b651aa0c21250aae7989f803919cab78d2) hci.c (4536712cf537b30280a15f1dc44cb8a2e738510b)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2092 unchanged lines hidden (view full) ---

2101 if (hci_stack->remote_name_state == GAP_REMOTE_NAME_STATE_W4_COMPLETE){
2102 hci_stack->remote_name_state = GAP_REMOTE_NAME_STATE_IDLE;
2103 }
2104 break;
2105 case HCI_EVENT_CONNECTION_REQUEST:
2106 reverse_bd_addr(&packet[2], addr);
2107 if (hci_stack->gap_classic_accept_callback != NULL){
2108 if ((*hci_stack->gap_classic_accept_callback)(addr) == 0){
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 2092 unchanged lines hidden (view full) ---

2101 if (hci_stack->remote_name_state == GAP_REMOTE_NAME_STATE_W4_COMPLETE){
2102 hci_stack->remote_name_state = GAP_REMOTE_NAME_STATE_IDLE;
2103 }
2104 break;
2105 case HCI_EVENT_CONNECTION_REQUEST:
2106 reverse_bd_addr(&packet[2], addr);
2107 if (hci_stack->gap_classic_accept_callback != NULL){
2108 if ((*hci_stack->gap_classic_accept_callback)(addr) == 0){
2109 hci_stack->decline_reason = 0x0d;
2109 hci_stack->decline_reason = ERROR_CODE_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR;
2110 bd_addr_copy(hci_stack->decline_addr, addr);
2111 break;
2112 }
2113 }
2114
2115 // TODO: eval COD 8-10
2116 link_type = packet[11];
2117 log_info("Connection_incoming: %s, type %u", bd_addr_to_str(addr), link_type);
2118 addr_type = link_type == 1 ? BD_ADDR_TYPE_CLASSIC : BD_ADDR_TYPE_SCO;
2119 conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
2120 if (!conn) {
2121 conn = create_connection_for_bd_addr_and_type(addr, addr_type);
2122 }
2123 if (!conn) {
2124 // CONNECTION REJECTED DUE TO LIMITED RESOURCES (0X0D)
2110 bd_addr_copy(hci_stack->decline_addr, addr);
2111 break;
2112 }
2113 }
2114
2115 // TODO: eval COD 8-10
2116 link_type = packet[11];
2117 log_info("Connection_incoming: %s, type %u", bd_addr_to_str(addr), link_type);
2118 addr_type = link_type == 1 ? BD_ADDR_TYPE_CLASSIC : BD_ADDR_TYPE_SCO;
2119 conn = hci_connection_for_bd_addr_and_type(addr, addr_type);
2120 if (!conn) {
2121 conn = create_connection_for_bd_addr_and_type(addr, addr_type);
2122 }
2123 if (!conn) {
2124 // CONNECTION REJECTED DUE TO LIMITED RESOURCES (0X0D)
2125 hci_stack->decline_reason = 0x0d;
2125 hci_stack->decline_reason = ERROR_CODE_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES;
2126 bd_addr_copy(hci_stack->decline_addr, addr);
2127 break;
2128 }
2129 conn->role = HCI_ROLE_SLAVE;
2130 conn->state = RECEIVED_CONNECTION_REQUEST;
2131 // store info about eSCO
2132 if (link_type == 0x02){
2133 conn->remote_supported_feature_eSCO = 1;

--- 3120 unchanged lines hidden ---
2126 bd_addr_copy(hci_stack->decline_addr, addr);
2127 break;
2128 }
2129 conn->role = HCI_ROLE_SLAVE;
2130 conn->state = RECEIVED_CONNECTION_REQUEST;
2131 // store info about eSCO
2132 if (link_type == 0x02){
2133 conn->remote_supported_feature_eSCO = 1;

--- 3120 unchanged lines hidden ---