hfp_hf.c (7f58ef6bd1acdef4b7de4a13b5a7faf9eaf35906) | hfp_hf.c (0f716b22f4772fb6e935f558c2bc19dec20fc588) |
---|---|
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 --- 1033 unchanged lines hidden (view full) --- 1042 return; 1043 } 1044 1045 // update HF indicators 1046 if (hfp_connection->generic_status_update_bitmap){ 1047 int i; 1048 for (i=0; i < hfp_hf_indicators_nr; i++){ 1049 if (get_bit(hfp_connection->generic_status_update_bitmap, i)){ | 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 --- 1033 unchanged lines hidden (view full) --- 1042 return; 1043 } 1044 1045 // update HF indicators 1046 if (hfp_connection->generic_status_update_bitmap){ 1047 int i; 1048 for (i=0; i < hfp_hf_indicators_nr; i++){ 1049 if (get_bit(hfp_connection->generic_status_update_bitmap, i)){ |
1050 hfp_connection->generic_status_update_bitmap = store_bit(hfp_connection->generic_status_update_bitmap, i, 0); |
|
1050 if (hfp_connection->generic_status_indicators[i].state){ 1051 hfp_connection->ok_pending = 1; | 1051 if (hfp_connection->generic_status_indicators[i].state){ 1052 hfp_connection->ok_pending = 1; |
1052 hfp_connection->generic_status_update_bitmap = store_bit(hfp_connection->generic_status_update_bitmap, i, 0); | |
1053 char buffer[30]; 1054 snprintf(buffer, sizeof(buffer), "AT%s=%u,%u\r", 1055 HFP_TRANSFER_HF_INDICATOR_STATUS, 1056 hfp_hf_indicators[i], 1057 (unsigned int)hfp_hf_indicators_value[i]); 1058 buffer[sizeof(buffer) - 1] = 0; 1059 send_str_over_rfcomm(hfp_connection->rfcomm_cid, buffer); 1060 } else { --- 1147 unchanged lines hidden (view full) --- 2208 hfp_connection_t * hfp_connection = get_hfp_hf_connection_context_for_acl_handle(acl_handle); 2209 if (!hfp_connection) { 2210 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; 2211 } 2212 // find index for assigned number 2213 int i; 2214 for (i = 0; i < hfp_hf_indicators_nr ; i++){ 2215 if (hfp_hf_indicators[i] == assigned_number){ | 1053 char buffer[30]; 1054 snprintf(buffer, sizeof(buffer), "AT%s=%u,%u\r", 1055 HFP_TRANSFER_HF_INDICATOR_STATUS, 1056 hfp_hf_indicators[i], 1057 (unsigned int)hfp_hf_indicators_value[i]); 1058 buffer[sizeof(buffer) - 1] = 0; 1059 send_str_over_rfcomm(hfp_connection->rfcomm_cid, buffer); 1060 } else { --- 1147 unchanged lines hidden (view full) --- 2208 hfp_connection_t * hfp_connection = get_hfp_hf_connection_context_for_acl_handle(acl_handle); 2209 if (!hfp_connection) { 2210 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER; 2211 } 2212 // find index for assigned number 2213 int i; 2214 for (i = 0; i < hfp_hf_indicators_nr ; i++){ 2215 if (hfp_hf_indicators[i] == assigned_number){ |
2216 // set value 2217 hfp_hf_indicators_value[i] = value; 2218 // mark for update | 2216 // check if connection ready and indicator subscribed |
2219 if (hfp_connection->state > HFP_LIST_GENERIC_STATUS_INDICATORS){ | 2217 if (hfp_connection->state > HFP_LIST_GENERIC_STATUS_INDICATORS){ |
2220 hfp_connection->generic_status_update_bitmap |= (1<<i); 2221 // send update 2222 hfp_hf_run_for_context(hfp_connection); | 2218 if (hfp_connection->generic_status_indicators[i].state != 0) { 2219 // set value 2220 hfp_hf_indicators_value[i] = value; 2221 // mark for update 2222 hfp_connection->generic_status_update_bitmap |= (1 << i); 2223 // send update 2224 hfp_hf_run_for_context(hfp_connection); 2225 } |
2223 } 2224 return ERROR_CODE_SUCCESS; 2225 } 2226 } 2227 return ERROR_CODE_SUCCESS; 2228} 2229 2230uint8_t hfp_hf_send_at_command(hci_con_handle_t acl_handle, const char * at_command){ --- 90 unchanged lines hidden --- | 2226 } 2227 return ERROR_CODE_SUCCESS; 2228 } 2229 } 2230 return ERROR_CODE_SUCCESS; 2231} 2232 2233uint8_t hfp_hf_send_at_command(hci_con_handle_t acl_handle, const char * at_command){ --- 90 unchanged lines hidden --- |