l2cap.c (5b2d3e12519bda8c473437aed656e840eede6ebd) | l2cap.c (989c549884f3b180a9f6ca6fd10e24bc72baf497) |
---|---|
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 --- 5231 unchanged lines hidden (view full) --- 5240 return BTSTACK_MEMORY_ALLOC_FAILED; 5241 } 5242 5243 // fill in 5244 service->psm = psm; 5245 service->mtu = 0; 5246 service->packet_handler = packet_handler; 5247 service->required_security_level = security_level; | 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 --- 5231 unchanged lines hidden (view full) --- 5240 return BTSTACK_MEMORY_ALLOC_FAILED; 5241 } 5242 5243 // fill in 5244 service->psm = psm; 5245 service->mtu = 0; 5246 service->packet_handler = packet_handler; 5247 service->required_security_level = security_level; |
5248 service->requires_authorization = false; |
|
5248 5249 // add to services list 5250 btstack_linked_list_add(&l2cap_le_services, (btstack_linked_item_t *) service); 5251 5252 // done 5253 return ERROR_CODE_SUCCESS; 5254} 5255 --- 145 unchanged lines hidden (view full) --- 5401 5402uint8_t l2cap_cbm_provide_credits(uint16_t local_cid, uint16_t credits){ 5403 return l2cap_credit_based_provide_credits(local_cid, credits); 5404} 5405#endif 5406 5407#ifdef ENABLE_L2CAP_ENHANCED_CREDIT_BASED_FLOW_CONTROL_MODE 5408 | 5249 5250 // add to services list 5251 btstack_linked_list_add(&l2cap_le_services, (btstack_linked_item_t *) service); 5252 5253 // done 5254 return ERROR_CODE_SUCCESS; 5255} 5256 --- 145 unchanged lines hidden (view full) --- 5402 5403uint8_t l2cap_cbm_provide_credits(uint16_t local_cid, uint16_t credits){ 5404 return l2cap_credit_based_provide_credits(local_cid, credits); 5405} 5406#endif 5407 5408#ifdef ENABLE_L2CAP_ENHANCED_CREDIT_BASED_FLOW_CONTROL_MODE 5409 |
5409uint8_t l2cap_ecbm_register_service(btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t min_remote_mtu, gap_security_level_t security_level){ | 5410uint8_t l2cap_ecbm_register_service(btstack_packet_handler_t packet_handler, uint16_t psm, uint16_t min_remote_mtu, 5411 gap_security_level_t security_level, bool authorization_required) { |
5410 5411 // check for already registered psm 5412 l2cap_service_t *service = l2cap_cbm_get_service(psm); 5413 if (service) { 5414 return L2CAP_SERVICE_ALREADY_REGISTERED; 5415 } 5416 5417 // alloc structure 5418 service = btstack_memory_l2cap_service_get(); 5419 if (!service) { 5420 log_error("register: no memory for l2cap_service_t"); 5421 return BTSTACK_MEMORY_ALLOC_FAILED; 5422 } 5423 5424 // fill in 5425 service->psm = psm; 5426 service->mtu = min_remote_mtu; 5427 service->packet_handler = packet_handler; 5428 service->required_security_level = security_level; | 5412 5413 // check for already registered psm 5414 l2cap_service_t *service = l2cap_cbm_get_service(psm); 5415 if (service) { 5416 return L2CAP_SERVICE_ALREADY_REGISTERED; 5417 } 5418 5419 // alloc structure 5420 service = btstack_memory_l2cap_service_get(); 5421 if (!service) { 5422 log_error("register: no memory for l2cap_service_t"); 5423 return BTSTACK_MEMORY_ALLOC_FAILED; 5424 } 5425 5426 // fill in 5427 service->psm = psm; 5428 service->mtu = min_remote_mtu; 5429 service->packet_handler = packet_handler; 5430 service->required_security_level = security_level; |
5431 service->requires_authorization = authorization_required; |
|
5429 5430 // add to services list 5431 btstack_linked_list_add(&l2cap_enhanced_services, (btstack_linked_item_t *) service); 5432 5433 // done 5434 return ERROR_CODE_SUCCESS; 5435} 5436 --- 280 unchanged lines hidden --- | 5432 5433 // add to services list 5434 btstack_linked_list_add(&l2cap_enhanced_services, (btstack_linked_item_t *) service); 5435 5436 // done 5437 return ERROR_CODE_SUCCESS; 5438} 5439 --- 280 unchanged lines hidden --- |