• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdint>
20 
21 #include "aidl/android/hardware/bluetooth/socket/BnBluetoothSocket.h"
22 
23 namespace aidl::android::hardware::bluetooth::socket::impl {
24 
25 /**
26  * The stub implementation of the BT Socket HAL.
27  */
28 class BluetoothSocketStub : public BnBluetoothSocket {
29  public:
30   // Functions implementing IBluetoothSocket.
registerCallback(const std::shared_ptr<IBluetoothSocketCallback> &)31   ndk::ScopedAStatus registerCallback(
32       const std::shared_ptr<IBluetoothSocketCallback> &) override {
33     return ndk::ScopedAStatus::ok();
34   }
35 
getSocketCapabilities(SocketCapabilities * result)36   ndk::ScopedAStatus getSocketCapabilities(
37       SocketCapabilities *result) override {
38     result->leCocCapabilities.numberOfSupportedSockets = 0;
39     result->leCocCapabilities.mtu = 1000;
40     result->rfcommCapabilities.numberOfSupportedSockets = 0;
41     result->rfcommCapabilities.maxFrameSize = 23;
42     return ndk::ScopedAStatus::ok();
43   }
44 
opened(const SocketContext &)45   ndk::ScopedAStatus opened(const SocketContext &) override {
46     return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
47   }
48 
closed(int64_t)49   ndk::ScopedAStatus closed(int64_t) override {
50     return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
51   }
52 };
53 
54 }  // namespace aidl::android::hardware::bluetooth::socket::impl
55