1 /******************************************************************************
2 * @file ble_l2cap_aci.c
3 * @author MCD Application Team
4 * @date 23 May 2019
5 * @brief Source file for ble api STM32WB (l2cap_aci)
6 * Auto-generated file: do not edit!
7 ******************************************************************************
8 * @attention
9 *
10 * <h2><center>© Copyright (c) 2019 STMicroelectronics.
11 * All rights reserved.</center></h2>
12 *
13 * This software component is licensed by ST under Ultimate Liberty license
14 * SLA0044, the "License"; You may not use this file except in compliance with
15 * the License. You may obtain a copy of the License at:
16 * www.st.com/SLA0044
17 *
18 ******************************************************************************
19 */
20
21 #include "ble_l2cap_aci.h"
22
aci_l2cap_connection_parameter_update_req(uint16_t Connection_Handle,uint16_t Conn_Interval_Min,uint16_t Conn_Interval_Max,uint16_t Slave_latency,uint16_t Timeout_Multiplier)23 tBleStatus aci_l2cap_connection_parameter_update_req(uint16_t Connection_Handle,
24 uint16_t Conn_Interval_Min,
25 uint16_t Conn_Interval_Max,
26 uint16_t Slave_latency,
27 uint16_t Timeout_Multiplier)
28 {
29 struct hci_request rq;
30 uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
31 aci_l2cap_connection_parameter_update_req_cp0 *cp0 = (aci_l2cap_connection_parameter_update_req_cp0*)(cmd_buffer);
32 tBleStatus status = 0;
33 int index_input = 0;
34 cp0->Connection_Handle = htob(Connection_Handle, 2);
35 index_input += 2;
36 cp0->Conn_Interval_Min = htob(Conn_Interval_Min, 2);
37 index_input += 2;
38 cp0->Conn_Interval_Max = htob(Conn_Interval_Max, 2);
39 index_input += 2;
40 cp0->Slave_latency = htob(Slave_latency, 2);
41 index_input += 2;
42 cp0->Timeout_Multiplier = htob(Timeout_Multiplier, 2);
43 index_input += 2;
44 Osal_MemSet(&rq, 0, sizeof(rq));
45 rq.ogf = 0x3f;
46 rq.ocf = 0x181;
47 rq.event = 0x0F;
48 rq.cparam = cmd_buffer;
49 rq.clen = index_input;
50 rq.rparam = &status;
51 rq.rlen = 1;
52 if (hci_send_req(&rq, FALSE) < 0)
53 return BLE_STATUS_TIMEOUT;
54 if (status)
55 {
56 return status;
57 }
58 return BLE_STATUS_SUCCESS;
59 }
60
aci_l2cap_connection_parameter_update_resp(uint16_t Connection_Handle,uint16_t Conn_Interval_Min,uint16_t Conn_Interval_Max,uint16_t Slave_latency,uint16_t Timeout_Multiplier,uint16_t Minimum_CE_Length,uint16_t Maximum_CE_Length,uint8_t Identifier,uint8_t Accept)61 tBleStatus aci_l2cap_connection_parameter_update_resp(uint16_t Connection_Handle,
62 uint16_t Conn_Interval_Min,
63 uint16_t Conn_Interval_Max,
64 uint16_t Slave_latency,
65 uint16_t Timeout_Multiplier,
66 uint16_t Minimum_CE_Length,
67 uint16_t Maximum_CE_Length,
68 uint8_t Identifier,
69 uint8_t Accept)
70 {
71 struct hci_request rq;
72 uint8_t cmd_buffer[BLE_CMD_MAX_PARAM_LEN];
73 aci_l2cap_connection_parameter_update_resp_cp0 *cp0 = (aci_l2cap_connection_parameter_update_resp_cp0*)(cmd_buffer);
74 tBleStatus status = 0;
75 int index_input = 0;
76 cp0->Connection_Handle = htob(Connection_Handle, 2);
77 index_input += 2;
78 cp0->Conn_Interval_Min = htob(Conn_Interval_Min, 2);
79 index_input += 2;
80 cp0->Conn_Interval_Max = htob(Conn_Interval_Max, 2);
81 index_input += 2;
82 cp0->Slave_latency = htob(Slave_latency, 2);
83 index_input += 2;
84 cp0->Timeout_Multiplier = htob(Timeout_Multiplier, 2);
85 index_input += 2;
86 cp0->Minimum_CE_Length = htob(Minimum_CE_Length, 2);
87 index_input += 2;
88 cp0->Maximum_CE_Length = htob(Maximum_CE_Length, 2);
89 index_input += 2;
90 cp0->Identifier = htob(Identifier, 1);
91 index_input += 1;
92 cp0->Accept = htob(Accept, 1);
93 index_input += 1;
94 Osal_MemSet(&rq, 0, sizeof(rq));
95 rq.ogf = 0x3f;
96 rq.ocf = 0x182;
97 rq.cparam = cmd_buffer;
98 rq.clen = index_input;
99 rq.rparam = &status;
100 rq.rlen = 1;
101 if (hci_send_req(&rq, FALSE) < 0)
102 return BLE_STATUS_TIMEOUT;
103 if (status)
104 {
105 return status;
106 }
107 return BLE_STATUS_SUCCESS;
108 }
109
110