bta_dm_qos.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2003-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This file contains the action functions for QoS state
  21. * machine.
  22. *
  23. ******************************************************************************/
  24. #include "bta/bta_sys.h"
  25. #include "bta/bta_api.h"
  26. #include "bta_dm_int.h"
  27. #include "stack/btm_api.h"
  28. #include "osi/allocator.h"
  29. #if (BTA_DM_QOS_INCLUDED == TRUE)
  30. void bta_dm_set_qos(tBTA_DM_MSG *p_data)
  31. {
  32. FLOW_SPEC p_flow = {
  33. .qos_flags = 0, /* TBD */
  34. .service_type = GUARANTEED, /* see below */
  35. .token_rate = 0, /* bytes/second */
  36. .token_bucket_size = 0, /* bytes */
  37. .peak_bandwidth = 0, /* bytes/second */
  38. .latency = 625 * p_data->qos_set.t_poll, /* microseconds */
  39. .delay_variation = 0xFFFFFFFF /* microseconds */
  40. };
  41. tBTM_STATUS status = BTM_SetQoS (p_data->qos_set.bd_addr, &p_flow, p_data->qos_set.p_cb);
  42. if(status != BTM_CMD_STARTED) {
  43. APPL_TRACE_ERROR("%s ERROR: 0x%x\n", __func__, status);
  44. }
  45. }
  46. void BTA_DmSetQos(BD_ADDR bd_addr, UINT32 t_poll, tBTM_CMPL_CB *p_cb)
  47. {
  48. tBTA_DM_API_QOS_SET *p_msg;
  49. if ((p_msg = (tBTA_DM_API_QOS_SET *) osi_malloc(sizeof(tBTA_DM_API_QOS_SET))) != NULL) {
  50. p_msg->hdr.event = BTA_DM_API_QOS_SET_EVT;
  51. bdcpy(p_msg->bd_addr, bd_addr);
  52. p_msg->t_poll = t_poll;
  53. p_msg->p_cb = p_cb;
  54. bta_sys_sendmsg(p_msg);
  55. }
  56. }
  57. #endif /// (BTA_DM_QOS_INCLUDED == TRUE)