Add CHLD support to HFP profile
cover Add CHLD support to HFP profile
This patch adds CHLD support to HFP profile.
AT+CHLD=0 uses release_all_held and set_udub
AT+CHLD=1 uses release_all_active
AT+CHLD=2 uses hold_all_active
AT+CHLD=3 uses create_multiparty
AT+CHLD=4 uses transfer
AT+CHLD=1X uses release_specific
AT+CHLD=2X uses private_chat
Best regards!
Frédéric Dalleau (7):
voicecall: Fix variable initialization
voicecall: add +CHLD support for HFP emulator
voicecall: add +CHLD=0 support for HFP emulator
voicecall: add +CHLD=3 support for HFP emulator
voicecall: add +CHLD=4 support for HFP emulator
voicecall: add +CHLD=1X support for HFP emulator
voicecall: add +CHLD=2X support for HFP emulator
src/voicecall.c | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 157 insertions(+), 0 deletions(-)
PATCH 1/7 voicecall: Fix variable initialization
--- src/voicecall.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
src/voicecall.c +1 -0
@@ -2600,6 +2600,7 @@ static void emulator_generic_cb(const struct ofono_error *error, void *data)struct ofono_emulator *em = data;struct ofono_error result; + result.error = error->error; result.type = error->type;ofono_emulator_send_final (em, &result);
Signature · 1 line
1.7.1
PATCH 2/7 voicecall: add +CHLD support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 0 deletions(-)
src/voicecall.c +70 -0
@@ -2417,6 +2417,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)OFONO_ATOM_TYPE_EMULATOR_HFP , emulator_remove_handler, "+CLCC"); +__ofono_modem_foreach_registered_atom (modem, +OFONO_ATOM_TYPE_EMULATOR_HFP , + emulator_remove_handler, +"+CHLD" );__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); }
@@ -2737,6 +2741,71 @@ static void emulator_clcc_cb(struct ofono_emulator *em,ofono_emulator_send_final (em, &result); } +static void emulator_chld_cb (struct ofono_emulator *em, +struct ofono_emulator_request *req,void *userdata) +{ +struct ofono_voicecall *vc = userdata; +struct ofono_error result; +char buf[22 ]; +char *info; +int chld; + + result.error =0 ; + +switch (ofono_emulator_request_get_type (req)) { +case OFONO_EMULATOR_REQUEST_TYPE_SET : +if (!ofono_emulator_request_next_number (req, &chld)) + goto fail; + +switch (chld) { +case 1 : +if (vc->driver->release_all_active ==NULL ) + goto fail; + + vc->driver->release_all_active (vc, + emulator_generic_cb, em); +return ; +case 2 : +if (vc->driver->hold_all_active ==NULL ) + goto fail; + + vc->driver->hold_all_active (vc, + emulator_generic_cb, em); +return ; +default : + goto fail; + } +break ; + +case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT : +memcpy (buf,"+CHLD=" ,6 ); + info = buf +6 ; + +if (vc->driver->release_all_active) + *info++ ='1' ; + +if (vc->driver->hold_all_active) { +if (info - buf >6 ) + *info++ =',' ; + + *info++ ='2' ; + } + + *info++ ='\0' ; + +ofono_emulator_send_info (em, buf, TRUE); + result.type =OFONO_ERROR_TYPE_NO_ERROR ; +break ; + +case OFONO_EMULATOR_REQUEST_TYPE_QUERY : +case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY : +fail: + result.type =OFONO_ERROR_TYPE_FAILURE ; + } + +ofono_emulator_send_final (em, &result); +} +static void emulator_hfp_watch (struct ofono_atom *atom,enum ofono_atom_watch_condition cond,void *data)
@@ -2751,6 +2820,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,ofono_emulator_add_handler (em,"A" , emulator_ata_cb, data,NULL );ofono_emulator_add_handler (em,"+CHUP" , emulator_chup_cb, data,NULL );ofono_emulator_add_handler (em,"+CLCC" , emulator_clcc_cb, data,NULL ); +ofono_emulator_add_handler (em,"+CHLD" , emulator_chld_cb, data,NULL ); }void ofono_voicecall_register (struct ofono_voicecall *vc)
Signature · 1 line
1.7.1
PATCH 3/7 voicecall: add +CHLD=0 support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-)
src/voicecall.c +24 -1
@@ -2758,6 +2758,22 @@ static void emulator_chld_cb(struct ofono_emulator *em, goto fail;switch (chld) { +case 0 : +if (vc->driver->set_udub ==NULL ) + goto fail; + +if (vc->driver->release_all_held ==NULL ) + goto fail; + +if (voicecalls_have_waiting (vc)) { + vc->driver->set_udub (vc, + emulator_generic_cb, em); +return ; + } + + vc->driver->release_all_held (vc, + emulator_generic_cb, em); +return ;case 1 :if (vc->driver->release_all_active ==NULL ) goto fail;
@@ -2781,8 +2797,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,memcpy (buf,"+CHLD=" ,6 ); info = buf +6 ; -if (vc->driver->release_all_active) +if (vc->driver->release_all_held && vc->driver->set_udub) + *info++ ='0' ; + +if (vc->driver->release_all_active) { +if (info - buf >6 ) + *info++ =',' ; + *info++ ='1' ; + }if (vc->driver->hold_all_active) {if (info - buf >6 )
Signature · 1 line
1.7.1
PATCH 4/7 voicecall: add +CHLD=3 support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
src/voicecall.c +14 -0
@@ -2788,6 +2788,13 @@ static void emulator_chld_cb(struct ofono_emulator *em, vc->driver->hold_all_active (vc, emulator_generic_cb, em);return ; +case 3 : +if (vc->driver->create_multiparty ==NULL ) + goto fail; + + vc->driver->create_multiparty (vc, + emulator_generic_cb, em); +return ;default : goto fail; }
@@ -2814,6 +2821,13 @@ static void emulator_chld_cb(struct ofono_emulator *em, *info++ ='2' ; } +if (vc->driver->create_multiparty) { +if (info - buf >6 ) + *info++ =',' ; + + *info++ ='3' ; + } + *info++ ='\0' ;ofono_emulator_send_info (em, buf, TRUE);
Signature · 1 line
1.7.1
PATCH 5/7 voicecall: add +CHLD=4 support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
src/voicecall.c +14 -0
@@ -2795,6 +2795,13 @@ static void emulator_chld_cb(struct ofono_emulator *em, vc->driver->create_multiparty (vc, emulator_generic_cb, em);return ; +case 4 : +if (vc->driver->transfer ==NULL ) + goto fail; + + vc->driver->transfer (vc, + emulator_generic_cb, em); +return ;default : goto fail; }
@@ -2828,6 +2835,13 @@ static void emulator_chld_cb(struct ofono_emulator *em, *info++ ='3' ; } +if (vc->driver->transfer) { +if (info - buf >6 ) + *info++ =',' ; + + *info++ ='4' ; + } + *info++ ='\0' ;ofono_emulator_send_info (em, buf, TRUE);
Signature · 1 line
1.7.1
PATCH 6/7 voicecall: add +CHLD=1X support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-)
src/voicecall.c +20 -2
@@ -2803,9 +2803,19 @@ static void emulator_chld_cb(struct ofono_emulator *em, emulator_generic_cb, em);return ;default : - goto fail; +break ; } -break ; + +if (chld >=10 && chld <=17 ) { +if (vc->driver->release_specific ==NULL ) + goto fail; + + vc->driver->release_specific (vc, chld -10 , + emulator_generic_cb, em); +return ; + } + + goto fail;case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT :memcpy (buf,"+CHLD=" ,6 );
@@ -2842,6 +2852,14 @@ static void emulator_chld_cb(struct ofono_emulator *em, *info++ ='4' ; } +if (vc->driver->release_specific) { +if (info - buf >6 ) + *info++ =',' ; + + *info++ ='1' ; + *info++ ='X' ; + } + *info++ ='\0' ;ofono_emulator_send_info (em, buf, TRUE);
Signature · 1 line
1.7.1
PATCH 7/7 voicecall: add +CHLD=2X support for HFP emulator
In reply to Frédéric Dalleau--- src/voicecall.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
src/voicecall.c +17 -0
@@ -2815,6 +2815,15 @@ static void emulator_chld_cb(struct ofono_emulator *em,return ; } +if (chld >=20 && chld <=27 ) { +if (vc->driver->private_chat ==NULL ) + goto fail; + + vc->driver->private_chat (vc, chld -20 , + emulator_generic_cb, em); +return ; + } + goto fail;case OFONO_EMULATOR_REQUEST_TYPE_SUPPORT :
@@ -2860,6 +2869,14 @@ static void emulator_chld_cb(struct ofono_emulator *em, *info++ ='X' ; } +if (vc->driver->private_chat) { +if (info - buf >6 ) + *info++ =',' ; + + *info++ ='2' ; + *info++ ='X' ; + } + *info++ ='\0' ;ofono_emulator_send_info (em, buf, TRUE);
Signature · 1 line
1.7.1
Hi Frédéric,
Quoted 10 lines · Frédéric Dalleau
This patch adds CHLD support to HFP profile.
AT+CHLD=0 uses
release_all_heldandset_udub
AT+CHLD=1 usesrelease_all_active
AT+CHLD=2 useshold_all_active
AT+CHLD=3 usescreate_multiparty
AT+CHLD=4 uses transfer
AT+CHLD=1X usesrelease_specific
AT+CHLD=2X usesprivate_chat
Quoted 2 lines
Best regards!
I applied all patches in this series, however I did make a few refactor commits afterwards. Please check and make sure I didn't screw anything up.
Regards,
-Denis