hfp_ag.c (ab2445a0204a8deaee8d62e6d3fba1e51a226576) hfp_ag.c (5be6b47a7f686392b26eff93e7600ba14ec6b01b)
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

--- 2056 unchanged lines hidden (view full) ---

2065 // note: before update AG indicators and ok_pending
2066 if (hfp_connection->send_response_and_hold_status){
2067 int status = hfp_connection->send_response_and_hold_status - 1;
2068 hfp_connection->send_response_and_hold_status = 0;
2069 hfp_ag_send_set_response_and_hold(hfp_connection->rfcomm_cid, status);
2070 return 1;
2071 }
2072
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

--- 2056 unchanged lines hidden (view full) ---

2065 // note: before update AG indicators and ok_pending
2066 if (hfp_connection->send_response_and_hold_status){
2067 int status = hfp_connection->send_response_and_hold_status - 1;
2068 hfp_connection->send_response_and_hold_status = 0;
2069 hfp_ag_send_set_response_and_hold(hfp_connection->rfcomm_cid, status);
2070 return 1;
2071 }
2072
2073 // note: before ok_pending and send_error to allow for unsolicited result on custom command
2074 if (hfp_connection->send_custom_message != NULL){
2075 const char * message = hfp_connection->send_custom_message;
2076 hfp_connection->send_custom_message = NULL;
2077 send_str_over_rfcomm(hfp_connection->rfcomm_cid, message);
2078 hfp_emit_event(hfp_connection, HFP_SUBEVENT_COMPLETE, ERROR_CODE_SUCCESS);
2079 return 1;
2080 }
2081
2073 if (hfp_connection->ok_pending){
2074 hfp_connection->ok_pending = 0;
2075 hfp_connection->command = HFP_CMD_NONE;
2076 hfp_ag_send_ok(hfp_connection->rfcomm_cid);
2077 return 1;
2078 }
2079
2080 // update AG indicators only if enabled by AT+CMER=3,0,0,1

--- 1009 unchanged lines hidden (view full) ---

3090 if (!hfp_connection){
3091 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
3092 }
3093
3094 hfp_connection->ok_pending = 1;
3095 return ERROR_CODE_SUCCESS;
3096}
3097
2082 if (hfp_connection->ok_pending){
2083 hfp_connection->ok_pending = 0;
2084 hfp_connection->command = HFP_CMD_NONE;
2085 hfp_ag_send_ok(hfp_connection->rfcomm_cid);
2086 return 1;
2087 }
2088
2089 // update AG indicators only if enabled by AT+CMER=3,0,0,1

--- 1009 unchanged lines hidden (view full) ---

3099 if (!hfp_connection){
3100 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
3101 }
3102
3103 hfp_connection->ok_pending = 1;
3104 return ERROR_CODE_SUCCESS;
3105}
3106
3107uint8_t hfp_ag_send_unsolicited_result_code(hci_con_handle_t acl_handle, const char * unsolicited_result_code){
3108 hfp_connection_t * hfp_connection = get_hfp_ag_connection_context_for_acl_handle(acl_handle);
3109 if (!hfp_connection){
3110 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
3111 }
3112 if (hfp_connection->send_custom_message != NULL){
3113 return ERROR_CODE_COMMAND_DISALLOWED;
3114 }
3115 hfp_connection->send_custom_message = unsolicited_result_code;
3116 hfp_ag_run_for_context(hfp_connection);
3117 return ERROR_CODE_SUCCESS;
3118}
3119
3098void hfp_ag_set_subcriber_number_information(hfp_phone_number_t * numbers, int numbers_count){
3099 hfp_ag_subscriber_numbers = numbers;
3100 hfp_ag_subscriber_numbers_count = numbers_count;
3101}
3102
3103void hfp_ag_clear_last_dialed_number(void){
3104 hfp_gsm_clear_last_dialed_number();
3105}

--- 67 unchanged lines hidden ---
3120void hfp_ag_set_subcriber_number_information(hfp_phone_number_t * numbers, int numbers_count){
3121 hfp_ag_subscriber_numbers = numbers;
3122 hfp_ag_subscriber_numbers_count = numbers_count;
3123}
3124
3125void hfp_ag_clear_last_dialed_number(void){
3126 hfp_gsm_clear_last_dialed_number();
3127}

--- 67 unchanged lines hidden ---