pbap_client.c (b56e8b561bce450f5cd8828749be22a67c2bd9ec) | pbap_client.c (7d6ceb6b5c6ee2074da47a196b81928f2a771ed5) |
---|---|
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 --- 605 unchanged lines hidden (view full) --- 614 } 615 return pos; 616} 617 618static uint16_t pbap_client_application_params_add_property_selector(const pbap_client_t * client, uint8_t * application_parameters){ 619 // TODO: support format 620 uint16_t pos = 0; 621 uint32_t property_selector_lower = client->property_selector; | 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 --- 605 unchanged lines hidden (view full) --- 614 } 615 return pos; 616} 617 618static uint16_t pbap_client_application_params_add_property_selector(const pbap_client_t * client, uint8_t * application_parameters){ 619 // TODO: support format 620 uint16_t pos = 0; 621 uint32_t property_selector_lower = client->property_selector; |
622 if (strncmp(pbap_client->vcard_name, "X-BT-UID:", 9) == 0) { 623 property_selector_lower |= 1U << 31; | 622 if (pbap_client->vcard_name != NULL){ 623 if (strncmp(pbap_client->vcard_name, "X-BT-UID:", 9) == 0) { 624 property_selector_lower |= 1U << 31; 625 } 626 if (strncmp(pbap_client->vcard_name, "X-BT-UCI:", 9) == 0) { 627 property_selector_lower |= 1U << 30; 628 } |
624 } | 629 } |
625 if (strncmp(pbap_client->vcard_name, "X-BT-UCI:", 9) == 0) { 626 property_selector_lower |= 1U << 30; 627 } | |
628 if (property_selector_lower != 0){ 629 application_parameters[pos++] = PBAP_APPLICATION_PARAMETER_PROPERTY_SELECTOR; 630 application_parameters[pos++] = 8; 631 big_endian_store_32(application_parameters, pos, 0); // upper 32-bits are reserved/unused so far 632 pos += 4; 633 big_endian_store_32(application_parameters, pos, property_selector_lower); 634 pos += 4; 635 } --- 141 unchanged lines hidden (view full) --- 777 // prepare request 778 goep_client_request_create_get(pbap_client->goep_cid); 779 if (pbap_client->request_number == 0){ 780 pbap_client_prepare_srm_header(pbap_client); 781 goep_client_header_add_name(pbap_client->goep_cid, pbap_client->phonebook_path); 782 goep_client_header_add_type(pbap_client->goep_cid, pbap_phonebook_type); 783 784 pos = 0; | 630 if (property_selector_lower != 0){ 631 application_parameters[pos++] = PBAP_APPLICATION_PARAMETER_PROPERTY_SELECTOR; 632 application_parameters[pos++] = 8; 633 big_endian_store_32(application_parameters, pos, 0); // upper 32-bits are reserved/unused so far 634 pos += 4; 635 big_endian_store_32(application_parameters, pos, property_selector_lower); 636 pos += 4; 637 } --- 141 unchanged lines hidden (view full) --- 779 // prepare request 780 goep_client_request_create_get(pbap_client->goep_cid); 781 if (pbap_client->request_number == 0){ 782 pbap_client_prepare_srm_header(pbap_client); 783 goep_client_header_add_name(pbap_client->goep_cid, pbap_client->phonebook_path); 784 goep_client_header_add_type(pbap_client->goep_cid, pbap_phonebook_type); 785 786 pos = 0; |
787 pos += pbap_client_application_params_add_property_selector(pbap_client, &application_parameters[pos]); |
|
785 pos += pbap_client_application_params_add_vcard_selector(pbap_client, &application_parameters[pos]); 786 pbap_client_add_application_parameters(pbap_client, application_parameters, pos); 787 } 788 // state 789 pbap_client->state = PBAP_W4_PHONEBOOK; 790 pbap_client->flow_next_triggered = 0; 791 pbap_client->flow_wait_for_user = 0; 792 // prepare response --- 411 unchanged lines hidden (view full) --- 1204 1205uint8_t pbap_pull_phonebook(uint16_t pbap_cid, const char * path){ 1206 UNUSED(pbap_cid); 1207 if (pbap_client->state != PBAP_CONNECTED){ 1208 return BTSTACK_BUSY; 1209 } 1210 pbap_client->state = PBAP_W2_PULL_PHONEBOOK; 1211 pbap_client->phonebook_path = path; | 788 pos += pbap_client_application_params_add_vcard_selector(pbap_client, &application_parameters[pos]); 789 pbap_client_add_application_parameters(pbap_client, application_parameters, pos); 790 } 791 // state 792 pbap_client->state = PBAP_W4_PHONEBOOK; 793 pbap_client->flow_next_triggered = 0; 794 pbap_client->flow_wait_for_user = 0; 795 // prepare response --- 411 unchanged lines hidden (view full) --- 1207 1208uint8_t pbap_pull_phonebook(uint16_t pbap_cid, const char * path){ 1209 UNUSED(pbap_cid); 1210 if (pbap_client->state != PBAP_CONNECTED){ 1211 return BTSTACK_BUSY; 1212 } 1213 pbap_client->state = PBAP_W2_PULL_PHONEBOOK; 1214 pbap_client->phonebook_path = path; |
1215 pbap_client->vcard_name = NULL; |
|
1212 pbap_client->request_number = 0; 1213 goep_client_request_can_send_now(pbap_client->goep_cid); 1214 return ERROR_CODE_SUCCESS; 1215} 1216 1217uint8_t pbap_set_phonebook(uint16_t pbap_cid, const char * path){ 1218 UNUSED(pbap_cid); 1219 if (pbap_client->state != PBAP_CONNECTED){ --- 126 unchanged lines hidden --- | 1216 pbap_client->request_number = 0; 1217 goep_client_request_can_send_now(pbap_client->goep_cid); 1218 return ERROR_CODE_SUCCESS; 1219} 1220 1221uint8_t pbap_set_phonebook(uint16_t pbap_cid, const char * path){ 1222 UNUSED(pbap_cid); 1223 if (pbap_client->state != PBAP_CONNECTED){ --- 126 unchanged lines hidden --- |