1 /*
2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "ble_protocol_interface_factory.h"
17 #include "conn_log.h"
18 #include "softbus_common.h"
19 #include "softbus_conn_ble_connection.h"
20 #include "softbus_conn_ble_client.h"
21 #include "softbus_conn_ble_server.h"
22
23 static BleUnifyInterface g_bleUnifyInterface[BLE_PROTOCOL_MAX] = {
24 [BLE_GATT] = {
25 .bleClientConnect = ConnGattClientConnect,
26 .bleClientDisconnect = ConnGattClientDisconnect,
27 .bleClientSend = ConnGattClientSend,
28 .bleClientUpdatePriority = ConnGattClientUpdatePriority,
29 .bleServerStartService = ConnGattServerStartService,
30 .bleServerStopService = ConnGattServerStopService,
31 .bleServerSend = ConnGattServerSend,
32 .bleServerDisconnect = ConnGattServerDisconnect,
33 .bleServerConnect = ConnGattServerConnect,
34 .bleClientInitModule = ConnGattInitClientModule,
35 .bleServerInitModule = ConnGattInitServerModule,
36 }
37 };
38
ConnBleGetUnifyInterface(BleProtocolType type)39 const BleUnifyInterface *ConnBleGetUnifyInterface(BleProtocolType type)
40 {
41 if (type != BLE_GATT) {
42 CONN_LOGE(CONN_BLE, "Failed to return type.");
43 return NULL;
44 }
45 return &g_bleUnifyInterface[type];
46 }