• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 #ifndef NAPI_BLUETOOTH_SPP_SERVER_H_
16 #define NAPI_BLUETOOTH_SPP_SERVER_H_
17 
18 #include <map>
19 #include "bluetooth_socket.h"
20 #include "napi_bluetooth_spp_client.h"
21 
22 namespace OHOS {
23 namespace Bluetooth {
24 void DefineSppFunctions(napi_env env, napi_value exports);
25 
26 struct NapiSppServer {
27     static napi_value SppListen(napi_env env, napi_callback_info info);
28     static napi_value SppAccept(napi_env env, napi_callback_info info);
29     static napi_value SppConnect(napi_env env, napi_callback_info info);
30     static napi_value SppCloseServerSocket(napi_env env, napi_callback_info info);
31 
32     static std::map<int, std::shared_ptr<NapiSppServer>> serverMap;
33     static int count;
34 
35     std::shared_ptr<SppServerSocket> server_ = nullptr;
36     int id_ = -1;
37 };
38 } // namespace Bluetooth
39 } // namespace OHOS
40 #endif /* NAPI_BLUETOOTH_SPP_SERVER_H_ */