hci.c (9071873a7706e2af321b366ef2d87a29ea0302e5) | hci.c (d9290e95f9161d0d54f386663529767f67c89689) |
---|---|
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 --- 7165 unchanged lines hidden (view full) --- 7174 conn = hci_connection_for_handle(little_endian_read_16(packet, 3)); 7175 if (conn == NULL) { 7176 // neither SCO nor ACL connection for con handle 7177 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; 7178 } else { 7179 switch (conn->address_type){ 7180 case BD_ADDR_TYPE_ACL: 7181 // assert SCO connection does not exit | 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 --- 7165 unchanged lines hidden (view full) --- 7174 conn = hci_connection_for_handle(little_endian_read_16(packet, 3)); 7175 if (conn == NULL) { 7176 // neither SCO nor ACL connection for con handle 7177 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; 7178 } else { 7179 switch (conn->address_type){ 7180 case BD_ADDR_TYPE_ACL: 7181 // assert SCO connection does not exit |
7182 conn = hci_connection_for_bd_addr_and_type(conn->address, BD_ADDR_TYPE_SCO); 7183 if (conn){ | 7182 if (hci_connection_for_bd_addr_and_type(conn->address, BD_ADDR_TYPE_SCO) != NULL){ |
7184 return ERROR_CODE_COMMAND_DISALLOWED; 7185 } 7186 // allocate connection struct 7187 conn = create_connection_for_bd_addr_and_type(conn->address, BD_ADDR_TYPE_SCO); 7188 if (!conn) { 7189 return ERROR_CODE_MEMORY_CAPACITY_EXCEEDED; 7190 } | 7183 return ERROR_CODE_COMMAND_DISALLOWED; 7184 } 7185 // allocate connection struct 7186 conn = create_connection_for_bd_addr_and_type(conn->address, BD_ADDR_TYPE_SCO); 7187 if (!conn) { 7188 return ERROR_CODE_MEMORY_CAPACITY_EXCEEDED; 7189 } |
7190 conn->role = HCI_ROLE_MASTER; |
|
7191 break; 7192 case BD_ADDR_TYPE_SCO: 7193 // update of existing SCO connection 7194 break; 7195 default: 7196 return ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS; 7197 } 7198 } | 7191 break; 7192 case BD_ADDR_TYPE_SCO: 7193 // update of existing SCO connection 7194 break; 7195 default: 7196 return ERROR_CODE_INVALID_HCI_COMMAND_PARAMETERS; 7197 } 7198 } |
7199 // conn refers to hci connection of type sco | 7199 7200 // conn refers to hci connection of type sco now 7201 |
7200 conn->state = SENT_CREATE_CONNECTION; | 7202 conn->state = SENT_CREATE_CONNECTION; |
7201 conn->role = HCI_ROLE_MASTER; | |
7202 7203 // track outgoing connection to handle command status with error 7204 hci_stack->outgoing_addr_type = BD_ADDR_TYPE_SCO; 7205 (void) memcpy(hci_stack->outgoing_addr, addr, 6); 7206 7207 // setup_synchronous_connection? Voice setting at offset 22 7208 // TODO: compare to current setting if sco connection already active 7209 hci_stack->sco_voice_setting_active = little_endian_read_16(packet, 15); --- 2835 unchanged lines hidden --- | 7203 7204 // track outgoing connection to handle command status with error 7205 hci_stack->outgoing_addr_type = BD_ADDR_TYPE_SCO; 7206 (void) memcpy(hci_stack->outgoing_addr, addr, 6); 7207 7208 // setup_synchronous_connection? Voice setting at offset 22 7209 // TODO: compare to current setting if sco connection already active 7210 hci_stack->sco_voice_setting_active = little_endian_read_16(packet, 15); --- 2835 unchanged lines hidden --- |