• 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 
16 #ifndef DISC_NSTACKX_ADAPTER_H
17 #define DISC_NSTACKX_ADAPTER_H
18 
19 #include <stdint.h>
20 #include "disc_manager.h"
21 
22 #ifdef __cplusplus
23 #if __cplusplus
24 extern "C" {
25 #endif
26 #endif
27 
28 typedef enum {
29     INVALID_MODE = -1,
30     ACTIVE_PUBLISH = 0,
31     ACTIVE_DISCOVERY,
32 } DiscCoapMode;
33 
34 typedef struct {
35     bool isPublish;
36     union {
37         PublishOption publishOption;
38         SubscribeOption subscribeOption;
39     } option;
40 } DiscOption;
41 
42 typedef struct {
43     int32_t freq;
44     DiscCoapMode mode;
45 } DiscCoapOption;
46 
47 int32_t DiscNstackxInit(void);
48 void DiscNstackxDeinit(void);
49 
50 int32_t DiscCoapRegisterCb(const DiscInnerCallback *discCoapCb);
51 int32_t DiscCoapRegisterCapability(uint32_t capabilityBitmapNum, uint32_t capabilityBitmap[]);
52 int32_t DiscCoapSetFilterCapability(uint32_t capabilityBitmapNum, uint32_t capabilityBitmap[]);
53 int32_t DiscCoapRegisterServiceData(const unsigned char *serviceData, uint32_t dataLen);
54 int32_t DiscCoapStartDiscovery(DiscCoapOption *option);
55 int32_t DiscCoapStopDiscovery(void);
56 void DiscCoapUpdateLocalIp(LinkStatus status);
57 void DiscCoapUpdateDevName(void);
58 
59 #ifdef __cplusplus
60 #if __cplusplus
61 }
62 #endif /* __cplusplus */
63 #endif /* __cplusplus */
64 
65 #endif // !DISC_NSTACKX_ADAPTER_H
66