• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 "broadcast_scheduler.h"
17 #include "disc_log.h"
18 #include "g_enhance_disc_func_pack.h"
19 
SchedulerInitBroadcast(void)20 int32_t SchedulerInitBroadcast(void)
21 {
22     return SchedulerInitBroadcastPacked();
23 }
24 
SchedulerDeinitBroadcast(void)25 int32_t SchedulerDeinitBroadcast(void)
26 {
27     return SchedulerDeinitBroadcastPacked();
28 }
29 
SchedulerRegisterBroadcaster(BroadcastProtocol protocol,BaseServiceType type,int32_t * bcId,const BroadcastCallback * cb)30 int32_t SchedulerRegisterBroadcaster(
31     BroadcastProtocol protocol, BaseServiceType type, int32_t *bcId, const BroadcastCallback *cb)
32 {
33     return RegisterBroadcaster(protocol, type, bcId, cb);
34 }
35 
SchedulerUnregisterBroadcaster(int32_t bcId)36 int32_t SchedulerUnregisterBroadcaster(int32_t bcId)
37 {
38     return UnRegisterBroadcaster(bcId);
39 }
40 
SchedulerRegisterScanListener(BroadcastProtocol protocol,BaseServiceType type,int32_t * listenerId,const ScanCallback * cb)41 int32_t SchedulerRegisterScanListener(
42     BroadcastProtocol protocol, BaseServiceType type, int32_t *listenerId, const ScanCallback *cb)
43 {
44     return RegisterScanListener(protocol, type, listenerId, cb);
45 }
46 
SchedulerUnregisterListener(int32_t listenerId)47 int32_t SchedulerUnregisterListener(int32_t listenerId)
48 {
49     return UnRegisterScanListener(listenerId);
50 }
51 
SchedulerStartBroadcast(int32_t bcId,BroadcastContentType contentType,const BroadcastParam * param,const BroadcastPacket * packet)52 int32_t SchedulerStartBroadcast(int32_t bcId, BroadcastContentType contentType, const BroadcastParam *param,
53     const BroadcastPacket *packet)
54 {
55     return SchedulerStartBroadcastPacked(bcId, contentType, param, packet);
56 }
57 
SchedulerUpdateBroadcast(int32_t bcId,const BroadcastParam * param,const BroadcastPacket * packet)58 int32_t SchedulerUpdateBroadcast(int32_t bcId, const BroadcastParam *param, const BroadcastPacket *packet)
59 {
60     return SchedulerUpdateBroadcastPacked(bcId, param, packet);
61 }
62 
SchedulerSetBroadcastData(int32_t bcId,const BroadcastPacket * packet)63 int32_t SchedulerSetBroadcastData(int32_t bcId, const BroadcastPacket *packet)
64 {
65     return SchedulerSetBroadcastDataPacked(bcId, packet);
66 }
67 
SchedulerSetBroadcastParam(int32_t bcId,const BroadcastParam * param)68 int32_t SchedulerSetBroadcastParam(int32_t bcId, const BroadcastParam *param)
69 {
70     return SchedulerSetBroadcastParamPacked(bcId, param);
71 }
72 
SchedulerStopBroadcast(int32_t bcId)73 int32_t SchedulerStopBroadcast(int32_t bcId)
74 {
75     return SchedulerStopBroadcastPacked(bcId);
76 }
77 
SchedulerStartScan(int32_t listenerId,const BcScanParams * param)78 int32_t SchedulerStartScan(int32_t listenerId, const BcScanParams *param)
79 {
80     return StartScan(listenerId, param);
81 }
82 
SchedulerStopScan(int32_t listenerId)83 int32_t SchedulerStopScan(int32_t listenerId)
84 {
85     return StopScan(listenerId);
86 }
87 
SchedulerSetScanFilter(int32_t listenerId,const BcScanFilter * scanFilter,uint8_t filterNum)88 int32_t SchedulerSetScanFilter(int32_t listenerId, const BcScanFilter *scanFilter, uint8_t filterNum)
89 {
90     return SetScanFilter(listenerId, scanFilter, filterNum);
91 }
92 
SchedulerGetScanFilter(int32_t listenerId,BcScanFilter ** scanFilter,uint8_t * filterNum)93 int32_t SchedulerGetScanFilter(int32_t listenerId, BcScanFilter **scanFilter, uint8_t *filterNum)
94 {
95     return GetScanFilter(listenerId, scanFilter, filterNum);
96 }
97 
SchedulerQueryBroadcastStatus(int32_t bcId,int32_t * status)98 int32_t SchedulerQueryBroadcastStatus(int32_t bcId, int32_t *status)
99 {
100     return QueryBroadcastStatus(bcId, status);
101 }
102 
SchedulerIsLpDeviceAvailable(void)103 bool SchedulerIsLpDeviceAvailable(void)
104 {
105     return BroadcastIsLpDeviceAvailable();
106 }
107 
SchedulerSetAdvDeviceParam(LpServerType type,const LpBroadcastParam * bcParam,const LpScanParam * scanParam)108 bool SchedulerSetAdvDeviceParam(LpServerType type, const LpBroadcastParam *bcParam,
109     const LpScanParam *scanParam)
110 {
111     return BroadcastSetAdvDeviceParam(type, bcParam, scanParam);
112 }
113 
SchedulerGetBroadcastHandle(int32_t bcId,int32_t * bcHandle)114 int32_t SchedulerGetBroadcastHandle(int32_t bcId, int32_t *bcHandle)
115 {
116     return BroadcastGetBroadcastHandle(bcId, bcHandle);
117 }
118 
SchedulerEnableSyncDataToLpDevice(void)119 int32_t SchedulerEnableSyncDataToLpDevice(void)
120 {
121     return BroadcastEnableSyncDataToLpDevice();
122 }
123 
SchedulerDisableSyncDataToLpDevice(void)124 int32_t SchedulerDisableSyncDataToLpDevice(void)
125 {
126     return BroadcastDisableSyncDataToLpDevice();
127 }
128 
SchedulerSetScanReportChannelToLpDevice(int32_t listenerId,bool enable)129 int32_t SchedulerSetScanReportChannelToLpDevice(int32_t listenerId, bool enable)
130 {
131     return BroadcastSetScanReportChannelToLpDevice(listenerId, enable);
132 }
133 
SchedulerSetLpAdvParam(int32_t duration,int32_t maxExtAdvEvents,int32_t window,int32_t interval,int32_t bcHandle)134 int32_t SchedulerSetLpAdvParam(int32_t duration, int32_t maxExtAdvEvents, int32_t window,
135     int32_t interval, int32_t bcHandle)
136 {
137     return BroadcastSetLpAdvParam(duration, maxExtAdvEvents, window, interval, bcHandle);
138 }
139