• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 "disc_manager.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 typedef enum {
28     INVALID_MODE = -1,
29     ACTIVE_PUBLISH = 0,
30     ACTIVE_DISCOVERY,
31 } DiscCoapMode;
32 
33 typedef struct {
34     bool isPublish;
35     union {
36         PublishOption publishOption;
37         SubscribeOption subscribeOption;
38     } option;
39 } DiscOption;
40 
41 typedef struct {
42     int32_t freq;
43     DiscCoapMode mode;
44     uint32_t capability;
45     uint32_t allCap;
46 } DiscCoapOption;
47 
48 int32_t DiscNstackxInit(void);
49 void DiscNstackxDeinit(void);
50 
51 int32_t DiscCoapRegisterCb(const DiscInnerCallback *discCoapCb);
52 int32_t DiscCoapRegisterCapability(uint32_t capabilityBitmapNum, uint32_t capabilityBitmap[]);
53 int32_t DiscCoapSetFilterCapability(uint32_t capabilityBitmapNum, uint32_t capabilityBitmap[]);
54 int32_t DiscCoapRegisterServiceData(const PublishOption *option, uint32_t allCap);
55 int32_t DiscCoapRegisterCapabilityData(const unsigned char *capabilityData, uint32_t dataLen, uint32_t capability);
56 int32_t DiscCoapStartDiscovery(DiscCoapOption *option);
57 int32_t DiscCoapStopDiscovery(void);
58 int32_t DiscCoapRegisterBusinessData(const unsigned char *capabilityData, uint32_t dataLen);
59 void DiscCoapRecordLinkStatus(LinkStatus status, int32_t ifnameIdx);
60 void DiscCoapModifyNstackThread(LinkStatus status, int32_t ifnameIdx);
61 void DiscCoapUpdateLocalIp(LinkStatus status, int32_t ifnameIdx);
62 void DiscCoapUpdateDevName(void);
63 void DiscCoapUpdateAccount(void);
64 int32_t DiscCoapSendRsp(const DeviceInfo *deviceInfo, uint8_t bType);
65 
66 #ifdef __cplusplus
67 #if __cplusplus
68 }
69 #endif /* __cplusplus */
70 #endif /* __cplusplus */
71 
72 #endif // !DISC_NSTACKX_ADAPTER_H
73