1 /* 2 * Copyright (c) 2022-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 OHOS_DM_SUBSCRIBE_INFO_H 17 #define OHOS_DM_SUBSCRIBE_INFO_H 18 19 #include <cstdbool> 20 21 #define DM_MAX_DEVICE_CAPABILITY_LEN 65 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 /** 26 * @brief Device manager discover mode. 27 */ 28 typedef enum DmDiscoverMode { 29 /** 30 * Passive. 31 */ 32 DM_DISCOVER_MODE_PASSIVE = 0x55, 33 /** 34 * Proactive. 35 */ 36 DM_DISCOVER_MODE_ACTIVE = 0xAA 37 } DmDiscoverMode; 38 39 /** 40 * @brief Service subscription medium. 41 */ 42 typedef enum DmExchangeMedium { 43 /** 44 * Automatic medium selection. 45 */ 46 DM_AUTO = 0, 47 /** 48 * Bluetooth 49 */ 50 DM_BLE = 1, 51 /** 52 * Wi-Fi 53 */ 54 DM_COAP = 2, 55 /** 56 * USB 57 */ 58 DM_USB = 3, 59 DM_MEDIUM_BUTT 60 } DmExchangeMedium; 61 62 /** 63 * @brief Enumerates frequencies for publishing services. 64 * 65 * This enumeration applies only to Bluetooth and is not supported currently. 66 */ 67 typedef enum DmExchangeFreq { 68 /** 69 * Low 70 */ 71 DM_LOW = 0, 72 /** 73 * Medium 74 */ 75 DM_MID = 1, 76 /** 77 * High 78 */ 79 DM_HIGH = 2, 80 /** 81 * Super-high 82 */ 83 DM_SUPER_HIGH = 3, 84 DM_FREQ_BUTT 85 } DmExchangeFreq; 86 87 /** 88 * @brief Service subscribe info for device discover. 89 */ 90 typedef struct DmSubscribeInfo { 91 /** 92 * Service ID. 93 */ 94 uint16_t subscribeId; 95 /** 96 * Discovery mode for service subscription. For details, see {@link DmDiscoverMode}. 97 */ 98 DmDiscoverMode mode; 99 /** 100 * Service subscription medium. For details, see {@link DmExchangeMedium}. 101 */ 102 DmExchangeMedium medium; 103 /** 104 * Service subscription frequency. For details, see {@link DmExchangeFreq}. 105 */ 106 DmExchangeFreq freq; 107 /** 108 * only find the device with the same account. 109 */ 110 bool isSameAccount; 111 /** 112 * find the sleeping devices. 113 */ 114 bool isWakeRemote; 115 /** 116 * Service subscription capability. 117 */ 118 char capability[DM_MAX_DEVICE_CAPABILITY_LEN]; 119 } DmSubscribeInfo; 120 } // namespace DistributedHardware 121 } // namespace OHOS 122 #endif // OHOS_DM_SUBSCRIBE_INFO_H 123