From c3d9e3b574638fb801d76af7f5ef01bb617c65fb Mon Sep 17 00:00:00 2001 From: Matthias Ringwald <matthias@ringwald.ch> Date: Sat, 13 Oct 2018 13:31:49 +0200 Subject: [PATCH] example/pbap_client_demo: set path to phonebook folder object for get vcard listing --- example/pbap_client_demo.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/example/pbap_client_demo.c b/example/pbap_client_demo.c index 0a1839827..053abebee 100644 --- a/example/pbap_client_demo.c +++ b/example/pbap_client_demo.c @@ -84,7 +84,8 @@ static const char * mch_name = "mch"; static const char * cch_name = "cch"; static const char * spd_name = "spd"; -static const char * phonebook_folder; +static const char * phonebook_name; +static char phonebook_folder[30]; static char phonebook_path[30]; static btstack_packet_callback_registration_t hci_event_callback_registration; @@ -94,6 +95,15 @@ static int sim1_selected; #ifdef HAVE_BTSTACK_STDIN +static void select_phonebook(const char * phonebook){ + phonebook_name = phonebook; + sprintf(phonebook_path, "%s%s.vcf", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook); + sprintf(phonebook_folder, "%s%s", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook); + printf("[-] Phonebook name '%s'\n", phonebook_name); + printf("[-] Phonebook folder '%s'\n", phonebook_folder); + printf("[-] Phonebook path '%s'\n", phonebook_path); +} + // Testig User Interface static void show_usage(void){ bd_addr_t iut_address; @@ -108,6 +118,7 @@ static void show_usage(void){ printf("b - select SIM1\n"); printf("r - set path to '/telecom'\n"); printf("R - set path to '/SIM1/telecom'\n"); + printf("u - set path to '%s'\n", phonebook_folder); printf("v - set vCardSelector to N and TEL\n"); printf("V - set vCardSelectorOperator to AND\n"); @@ -131,13 +142,6 @@ static void show_usage(void){ printf("\n"); } -static void select_phonebook(const char * phonebook){ - phonebook_folder = phonebook; - sprintf(phonebook_path, "%s%s.vcf", sim1_selected ? "SIM1/telecom/" : "telecom/", phonebook); - printf("[-] Phonebook folder '%s'\n", phonebook_folder); - printf("[-] Phonebook path '%s'\n", phonebook_path); -} - static void stdin_process(char c){ switch (c){ case 'a': @@ -164,7 +168,7 @@ static void stdin_process(char c){ break; case 'l': printf("[+] Pull vCard list for '%s'\n", phonebook_folder); - pbap_pull_vcard_listing(pbap_cid, phonebook_folder); + pbap_pull_vcard_listing(pbap_cid, ""); break; case 'c': @@ -215,6 +219,10 @@ static void stdin_process(char c){ printf("[+] Set path to '/SIM1/telecom'\n"); pbap_set_phonebook(pbap_cid, "SIM1/telecom"); break; + case 'u': + printf("[+] Set path to '%s'\n", phonebook_folder); + pbap_set_phonebook(pbap_cid, phonebook_folder); + break; case 'x': printf("[+] Abort'\n"); pbap_abort(pbap_cid);