xref: /aosp_15_r20/external/openthread/src/posix/platform/ble.cpp (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1 /*
2  *  Copyright (c) 2023, The OpenThread Authors.
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *  1. Redistributions of source code must retain the above copyright
8  *     notice, this list of conditions and the following disclaimer.
9  *  2. Redistributions in binary form must reproduce the above copyright
10  *     notice, this list of conditions and the following disclaimer in the
11  *     documentation and/or other materials provided with the distribution.
12  *  3. Neither the name of the copyright holder nor the
13  *     names of its contributors may be used to endorse or promote products
14  *     derived from this software without specific prior written permission.
15  *
16  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  *  POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include <openthread/tcat.h>
30 #include <openthread/platform/ble.h>
31 
otPlatBleEnable(otInstance * aInstance)32 otError otPlatBleEnable(otInstance *aInstance)
33 {
34     OT_UNUSED_VARIABLE(aInstance);
35     return OT_ERROR_NOT_IMPLEMENTED;
36 }
37 
otPlatBleDisable(otInstance * aInstance)38 otError otPlatBleDisable(otInstance *aInstance)
39 {
40     OT_UNUSED_VARIABLE(aInstance);
41     return OT_ERROR_NOT_IMPLEMENTED;
42 }
43 
otPlatBleGetAdvertisementBuffer(otInstance * aInstance,uint8_t ** aAdvertisementBuffer)44 otError otPlatBleGetAdvertisementBuffer(otInstance *aInstance, uint8_t **aAdvertisementBuffer)
45 {
46     OT_UNUSED_VARIABLE(aInstance);
47     static uint8_t sAdvertisementBuffer[OT_TCAT_ADVERTISEMENT_MAX_LEN];
48 
49     *aAdvertisementBuffer = sAdvertisementBuffer;
50 
51     return OT_ERROR_NONE;
52 }
53 
otPlatBleGapAdvStart(otInstance * aInstance,uint16_t aInterval)54 otError otPlatBleGapAdvStart(otInstance *aInstance, uint16_t aInterval)
55 {
56     OT_UNUSED_VARIABLE(aInstance);
57     OT_UNUSED_VARIABLE(aInterval);
58     return OT_ERROR_NOT_IMPLEMENTED;
59 }
60 
otPlatBleGapAdvStop(otInstance * aInstance)61 otError otPlatBleGapAdvStop(otInstance *aInstance)
62 {
63     OT_UNUSED_VARIABLE(aInstance);
64     return OT_ERROR_NOT_IMPLEMENTED;
65 }
66 
otPlatBleGapDisconnect(otInstance * aInstance)67 otError otPlatBleGapDisconnect(otInstance *aInstance)
68 {
69     OT_UNUSED_VARIABLE(aInstance);
70     return OT_ERROR_NOT_IMPLEMENTED;
71 }
72 
otPlatBleGattMtuGet(otInstance * aInstance,uint16_t * aMtu)73 otError otPlatBleGattMtuGet(otInstance *aInstance, uint16_t *aMtu)
74 {
75     OT_UNUSED_VARIABLE(aInstance);
76     OT_UNUSED_VARIABLE(aMtu);
77     return OT_ERROR_NOT_IMPLEMENTED;
78 }
79 
otPlatBleGattServerIndicate(otInstance * aInstance,uint16_t aHandle,const otBleRadioPacket * aPacket)80 otError otPlatBleGattServerIndicate(otInstance *aInstance, uint16_t aHandle, const otBleRadioPacket *aPacket)
81 {
82     OT_UNUSED_VARIABLE(aInstance);
83     OT_UNUSED_VARIABLE(aHandle);
84     OT_UNUSED_VARIABLE(aPacket);
85     return OT_ERROR_NOT_IMPLEMENTED;
86 }
87 
otPlatBleGetLinkCapabilities(otInstance * aInstance,otBleLinkCapabilities * aBleLinkCapabilities)88 void otPlatBleGetLinkCapabilities(otInstance *aInstance, otBleLinkCapabilities *aBleLinkCapabilities)
89 {
90     OT_UNUSED_VARIABLE(aInstance);
91 
92     aBleLinkCapabilities->mGattNotifications = 1;
93     aBleLinkCapabilities->mL2CapDirect       = 0;
94     aBleLinkCapabilities->mRsv               = 0;
95 }
96 
otPlatBleGapAdvSetData(otInstance * aInstance,uint8_t * aAdvertisementData,uint16_t aAdvertisementLen)97 otError otPlatBleGapAdvSetData(otInstance *aInstance, uint8_t *aAdvertisementData, uint16_t aAdvertisementLen)
98 {
99     OT_UNUSED_VARIABLE(aInstance);
100     OT_UNUSED_VARIABLE(aAdvertisementData);
101     OT_UNUSED_VARIABLE(aAdvertisementLen);
102     return OT_ERROR_NONE;
103 }
104 
otPlatBleSupportsMultiRadio(otInstance * aInstance)105 bool otPlatBleSupportsMultiRadio(otInstance *aInstance)
106 {
107     OT_UNUSED_VARIABLE(aInstance);
108     return false;
109 }
110