• 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 OHOS_DM_SUBSCRIBE_INFO_H
17 #define OHOS_DM_SUBSCRIBE_INFO_H
18 
19 #include <stdbool.h>
20 
21 #define DM_MAX_DEVICE_CAPABILITY_LEN 65
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 typedef enum DmDiscoverMode {
26     /* Passive */
27     DM_DISCOVER_MODE_PASSIVE = 0x55,
28     /* Proactive */
29     DM_DISCOVER_MODE_ACTIVE = 0xAA
30 } DmDiscoverMode;
31 
32 typedef enum DmExchangeMedium {
33     /** Automatic medium selection */
34     DM_AUTO = 0,
35     /** Bluetooth */
36     DM_BLE = 1,
37     /** Wi-Fi */
38     DM_COAP = 2,
39     /** USB */
40     DM_USB = 3,
41     DM_MEDIUM_BUTT
42 } DmExchangeMedium;
43 
44 /**
45  * @brief Enumerates frequencies for publishing services.
46  *
47  * This enumeration applies only to Bluetooth and is not supported currently.
48  */
49 typedef enum DmExchangeFreq {
50     /** Low */
51     DM_LOW = 0,
52     /** Medium */
53     DM_MID = 1,
54     /** High */
55     DM_HIGH = 2,
56     /** Super-high */
57     DM_SUPER_HIGH = 3,
58     DM_FREQ_BUTT
59 } DmExchangeFreq;
60 
61 typedef struct DmSubscribeInfo {
62     /** Service ID */
63     uint16_t subscribeId;
64     /** Discovery mode for service subscription. For details, see {@link DmDiscoverMode}. */
65     DmDiscoverMode mode;
66     /** Service subscription medium. For details, see {@link DmExchangeMedium}. */
67     DmExchangeMedium medium;
68     /** Service subscription frequency. For details, see {@link DmExchangeFreq}. */
69     DmExchangeFreq freq;
70     /** only find the device with the same account */
71     bool isSameAccount;
72     /** find the sleeping devices */
73     bool isWakeRemote;
74     /** Service subscription capability. */
75     char capability[DM_MAX_DEVICE_CAPABILITY_LEN];
76 } DmSubscribeInfo;
77 } // namespace DistributedHardware
78 } // namespace OHOS
79 #endif // OHOS_DM_SUBSCRIBE_INFO_H
80