3#include <kindlebt/compat_ace_shims.h>
10#include <kindlebt/compat_ace_implementations.h>
21 static getSessionForCallback_fn_t old_api = NULL;
22 static getSessionForTask_fn_t new_api = NULL;
23 static bool initialized =
false;
26 new_api = (getSessionForTask_fn_t)dlsym(RTLD_DEFAULT,
"getSessionForTask");
28 old_api = (getSessionForCallback_fn_t)dlsym(RTLD_DEFAULT,
"getSessionForCallback");
36 return old_api(task->callback_id);
39 log_error(
"[%s()]: couldn't match any of the expected getSessionFor* symbols", __func__);
44typedef status_t (*aceBt_bleRegisterGattClient_tn_t)(
51 static aceBt_bleRegisterGattClient_tn_t new_api = NULL;
54 static bool initialized =
false;
58 (aceBt_bleRegisterGattClient_tn_t)dlsym(RTLD_DEFAULT,
"aceBt_bleRegisterGattClient");
64 return new_api(session_handle, callbacks, app_id);
66 return pre5170_bleRegisterGattClient(session_handle, callbacks, app_id);
73 static aceBT_bleDeRegisterGattClient_fn_t new_api = NULL;
76 static bool initialized =
false;
79 new_api = (aceBT_bleDeRegisterGattClient_fn_t)dlsym(
80 RTLD_DEFAULT,
"aceBT_bleDeRegisterGattClient"
87 return new_api(session_handle);
89 return pre5170_bleDeregisterGattClient(session_handle);
96 static aceBT_bleDiscoverAllServices_fn_t new_api = NULL;
99 static bool initialized =
false;
103 (aceBT_bleDiscoverAllServices_fn_t)dlsym(RTLD_DEFAULT,
"aceBT_bleDiscoverAllServices");
109 return new_api(session_handle, conn_handle);
111 return pre5170_bleDiscoverAllServices(session_handle, conn_handle);
118 static aceBT_bleGetService_fn_t new_api = NULL;
121 static bool initialized =
false;
124 new_api = (aceBT_bleGetService_fn_t)dlsym(RTLD_DEFAULT,
"aceBT_bleGetService");
130 return new_api(conn_handle);
132 return pre5170_bleGetService(conn_handle);
136typedef status_t (*aceBT_bleReadCharacteristics_fn_t)(
144 static aceBT_bleReadCharacteristics_fn_t new_api = NULL;
147 static bool initialized =
false;
151 (aceBT_bleReadCharacteristics_fn_t)dlsym(RTLD_DEFAULT,
"aceBT_bleReadCharacteristics");
157 return new_api(session_handle, conn_handle, chars_value);
159 return pre5170_bleReadCharacteristic(session_handle, conn_handle, chars_value);
163typedef status_t (*aceBT_bleWriteCharacteristics_fn_t)(
167status_t shim_bleWriteCharacteristic(
171 static aceBT_bleWriteCharacteristics_fn_t new_api = NULL;
174 static bool initialized =
false;
177 new_api = (aceBT_bleWriteCharacteristics_fn_t)dlsym(
178 RTLD_DEFAULT,
"aceBT_bleWriteCharacteristics"
185 return new_api(session_handle, conn_handle, chars_value, request_type);
187 return pre5170_bleWriteCharacteristics(
188 session_handle, conn_handle, chars_value, request_type
193typedef status_t (*aceBT_bleWriteDescriptor_fn_t)(
201 static aceBT_bleWriteDescriptor_fn_t new_api = NULL;
204 static bool initialized =
false;
208 (aceBT_bleWriteCharacteristics_fn_t)dlsym(RTLD_DEFAULT,
"aceBT_bleWriteDescriptor");
213 return new_api(session_handle, conn_handle, chars_value, request_type);
215 return pre5170_bleWriteDescriptor(session_handle, conn_handle, chars_value, request_type);
219typedef status_t (*aceBT_bleSetNotification_fn_t)(
227 static aceBT_bleSetNotification_fn_t new_api = NULL;
230 static bool initialized =
false;
233 new_api = (aceBT_bleSetNotification_fn_t)dlsym(RTLD_DEFAULT,
"aceBT_bleSetNotification");
239 return new_api(session_handle, conn_handle, chars_value, enable);
241 return pre5170_bleSetNotification(session_handle, conn_handle, chars_value, enable);
aceBT_bleGattClientCallbacks_t bleGattClientCallbacks_t
Callback struct of GATT Client Bluetooth operations.
aceBt_bleAppId_t bleAppId_t
BLE application type.
aceBT_responseType_t responseType_t
Type of write operation for a BLE characteristic.
ace_status_t status_t
Bluetooth API status codes.
aceBT_bleConnHandle bleConnHandle
Connection handle for the lifetime of a Bluetooth connection.
aceBT_sessionHandle sessionHandle
Session handle for the lifetime of the Bluetooth application.
aceBT_bleGattCharacteristicsValue_t bleGattCharacteristicsValue_t
BLE GATT Characteristic.