• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef DISC_MANAGER_STRUCT_H
17 #define DISC_MANAGER_STRUCT_H
18 
19 #include <stdint.h>
20 
21 #include "disc_interface_struct.h"
22 #include "softbus_common.h"
23 
24 #ifdef __cplusplus
25 #if __cplusplus
26 extern "C" {
27 #endif
28 #endif
29 
30 #define CAPABILITY_NUM                  1
31 #define CAPABILITY_MAX_BITNUM           16
32 
33 typedef struct {
34     int32_t freq;
35     uint32_t capabilityBitmap[CAPABILITY_NUM];
36     uint8_t *capabilityData;
37     uint32_t dataLen;
38     bool ranging;
39 } PublishOption;
40 
41 typedef struct {
42     bool isSameAccount;
43     bool isWakeRemote;
44     int32_t freq;
45     uint32_t capabilityBitmap[CAPABILITY_NUM];
46     uint32_t dataLen;
47     uint8_t *capabilityData;
48 } SubscribeOption;
49 
50 typedef enum {
51     PUBLISH_FUNC = 0,
52     UNPUBLISH_FUNC = 1,
53     STARTDISCOVERTY_FUNC = 2,
54     STOPDISCOVERY_FUNC = 3
55 } InterfaceFuncType;
56 
57 typedef struct {
58     int32_t (*Publish)(const PublishOption *option);
59     int32_t (*StartScan)(const PublishOption *option);
60     int32_t (*Unpublish)(const PublishOption *option);
61     int32_t (*StopScan)(const PublishOption *option);
62     int32_t (*StartAdvertise)(const SubscribeOption *option);
63     int32_t (*Subscribe)(const SubscribeOption *option);
64     int32_t (*Unsubscribe)(const SubscribeOption *option);
65     int32_t (*StopAdvertise)(const SubscribeOption *option);
66     void (*LinkStatusChanged)(LinkStatus status, int32_t ifnameIdx);
67     void (*UpdateLocalDeviceInfo)(InfoTypeChanged type);
68 } DiscoveryFuncInterface;
69 
70 typedef struct {
71     int32_t (*OnServerDeviceFound)(const char *packageName, const DeviceInfo *device,
72                                    const InnerDeviceInfoAddtions *additions);
73 } IServerDiscInnerCallback;
74 
75 #ifdef __cplusplus
76 #if __cplusplus
77 }
78 #endif /* __cplusplus */
79 #endif /* __cplusplus */
80 
81 #endif /* DISC_MANAGER_STRUCT_H */