1 /* 2 * Copyright (C) 2021-2022 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 #ifndef OHOS_DEFINE_H 16 #define OHOS_DEFINE_H 17 18 #ifndef OHOS_ARCH_LITE 19 #include "system_ability_definition.h" 20 #endif 21 22 /* The response message ID of callback */ 23 #define WIFI_CBK_MSG_STATE_CHANGE 0x1001 24 #define WIFI_CBK_MSG_CONNECTION_CHANGE 0x1002 25 #define WIFI_CBK_MSG_RSSI_CHANGE 0x1003 26 #define WIFI_CBK_MSG_STREAM_DIRECTION 0x1004 27 #define WIFI_CBK_MSG_WPS_STATE_CHANGE 0x1005 28 #define WIFI_CBK_MSG_DEVICE_CONFIG_CHANGE 0x1006 29 #define WIFI_CBK_MSG_SEMI_STATE_CHANGE 0x1007 30 #define WIFI_CBK_MSG_INTERNET_ACCESS_CHANGE 0x1008 31 #define WIFI_CBK_MSG_CANDIDATE_CONNECT_CHANGE 0x1009 32 #define WIFI_CBK_MSG_MAX_INVALID_STA 0x1FFF /* STA invalid value */ 33 34 #define WIFI_CBK_MSG_SCAN_STATE_CHANGE 0x2001 35 36 #define WIFI_CBK_MSG_HOTSPOT_STATE_CHANGE 0x3001 37 #define WIFI_CBK_MSG_HOTSPOT_STATE_JOIN 0x3002 38 #define WIFI_CBK_MSG_HOTSPOT_STATE_LEAVE 0x3003 39 #define WIFI_CBK_MSG_MAX_INVALID_HOTSPOT 0x3FFF /* HOTSPOT invalid value */ 40 41 #define WIFI_CBK_MSG_P2P_STATE_CHANGE 0x4001 42 #define WIFI_CBK_MSG_PERSISTENT_GROUPS_CHANGE 0x4002 /* Persistent Group Updated */ 43 #define WIFI_CBK_MSG_THIS_DEVICE_CHANGE 0x4003 44 #define WIFI_CBK_MSG_PEER_CHANGE 0x4004 45 #define WIFI_CBK_MSG_SERVICE_CHANGE 0x4005 46 #define WIFI_CBK_MSG_CONNECT_CHANGE 0x4006 47 #define WIFI_CBK_MSG_DISCOVERY_CHANGE 0x4007 48 #define WIFI_CBK_MSG_P2P_ACTION_RESULT 0x4008 49 #define WIFI_CBK_MSG_CFG_CHANGE 0x4009 50 #define WIFI_CBK_MSG_P2P_GC_JOIN_GROUP 0x4010 51 #define WIFI_CBK_MSG_P2P_GC_LEAVE_GROUP 0x4011 52 #define WIFI_CBK_MSG_PRIVATE_PEER_CHANGE 0x4012 53 #define WIFI_CBK_MSG_P2P_CHR_ERRCODE_REPORT 0x4013 54 #define WIFI_CBK_MSG_MAX_INVALID_P2P 0x4FFF /* P2P invalid value */ 55 56 /* -----------Callback event name define-------------- */ 57 #define EVENT_STA_POWER_STATE_CHANGE "wifiStateChange" 58 #define EVENT_STA_CONN_STATE_CHANGE "wifiConnectionChange" 59 #define EVENT_STA_RSSI_STATE_CHANGE "wifiRssiChange" 60 #define EVENT_STA_WPS_STATE_CHANGE "wifiWpsStateChange" 61 #define EVENT_STREAM_CHANGE "streamChange" 62 #define EVENT_STA_DEVICE_CONFIG_CHANGE "deviceConfigChange" 63 #define EVENT_STA_CANDIDATE_CONNECT_CHANGE "candidateConnectChange" 64 #define EVENT_STA_SCAN_STATE_CHANGE "wifiScanStateChange" /* STA*/ 65 66 #define EVENT_HOTSPOT_STATE_CHANGE "hotspotStateChange" 67 #define EVENT_HOTSPOT_STA_JOIN "hotspotStaJoin" 68 #define EVENT_HOTSPOT_STA_LEAVE "hotspotStaLeave" /* AP */ 69 70 #define EVENT_P2P_STATE_CHANGE "p2pStateChange" 71 #define EVENT_P2P_PERSISTENT_GROUP_CHANGE "p2pPersistentGroupChange" 72 #define EVENT_P2P_DEVICE_STATE_CHANGE "p2pDeviceChange" 73 #define EVENT_P2P_PEER_DEVICE_CHANGE "p2pPeerDeviceChange" 74 #define EVENT_P2P_SERVICES_CHANGE "p2pServicesChange" 75 #define EVENT_P2P_CONN_STATE_CHANGE "p2pConnectionChange" 76 #define EVENT_P2P_DISCOVERY_CHANGE "p2pDiscoveryChange" 77 #define EVENT_P2P_ACTION_RESULT "p2pActionResult" 78 #define EVENT_P2P_CONFIG_CHANGE "p2pConfigChange" 79 #define EVENT_P2P_GC_JOIN_GROUP "p2pGcJoinGroup" 80 #define EVENT_P2P_GC_LEAVE_GROUP "p2pGcLeaveGroup" 81 #define EVENT_P2P_PRIVATE_PEER_DEVICE_CHANGE "p2pPrivatePeerDeviceChange" 82 #define EVENT_P2P_CHR_ERRCODE_REPORT "p2pChrErrCodeReport" /* P2P */ 83 84 /* -----------Feature service name-------------- */ 85 #define WIFI_SERVICE_STA "StaService" /* STA */ 86 #define WIFI_SERVICE_SELFCURE "SelfCureService" /* SELFCURE */ 87 #define WIFI_SERVICE_WIFIPRO "WifiProService" /* WIFIPRO */ 88 #define WIFI_SERVICE_AP "ApService" /* AP */ 89 #define WIFI_SERVICE_P2P "P2pService" /* P2P */ 90 #define WIFI_SERVICE_SCAN "ScanService" /* SCAN */ 91 #define WIFI_SERVICE_AWARE "AwareService" /* AWARE */ 92 #define WIFI_SERVICE_ENHANCE "EnhanceService" /* ENHANCE */ 93 /* ---------Feature service ability id */ 94 #ifdef OHOS_ARCH_LITE 95 #define WIFI_DEVICE_ABILITY_ID 1120 96 #define WIFI_HOTSPOT_ABILITY_ID 1121 97 #define WIFI_P2P_ABILITY_ID 1123 98 #define WIFI_SCAN_ABILITY_ID 1124 99 #else 100 #define WIFI_DEVICE_ABILITY_ID OHOS::WIFI_DEVICE_SYS_ABILITY_ID /* 1120 */ 101 #define WIFI_HOTSPOT_ABILITY_ID OHOS::WIFI_HOTSPOT_SYS_ABILITY_ID /* 1121 */ 102 #define WIFI_P2P_ABILITY_ID OHOS::WIFI_P2P_SYS_ABILITY_ID /* 1123 */ 103 #define WIFI_SCAN_ABILITY_ID OHOS::WIFI_SCAN_SYS_ABILITY_ID /* 1124 */ 104 #endif 105 106 #define MODE_STATE_SCREEN (1) 107 #define MODE_STATE_AIR_PLANE (2) 108 #define MODE_STATE_APP_RUN (3) 109 #define MODE_STATE_POWER_SAVING (4) 110 #define MODE_STATE_FREEZE (5) 111 #define MODE_STATE_NO_CHARGER_PLUG (6) 112 113 #define MODE_STATE_EXPAND (1) 114 #define MODE_STATE_FOLDED (2) 115 #define MODE_STATE_HALF_FOLD (3) 116 117 #define MODE_STATE_DEFAULT (-1) 118 /* Begin apf filter */ 119 #define MODE_STATE_OPEN (1) 120 #define MODE_STATE_CLOSE (2) 121 /* End apf filter */ 122 #define WIFI_STATE_DISABLED (0) 123 #define WIFI_STATE_ENABLED (1) 124 #define WIFI_STATE_SEMI_ENABLED (2) 125 #define INTERFACEDESCRIPTORL1 u"ohos.wifi.IWifiDeviceService" 126 #define DECLARE_INTERFACE_DESCRIPTOR_L1_LENGTH (sizeof(INTERFACEDESCRIPTORL1)/sizeof(uint16_t)) 127 #define DECLARE_INTERFACE_DESCRIPTOR_L1 ((uint16_t*)&INTERFACEDESCRIPTORL1[0]) 128 129 /* Multilink */ 130 #define INSTID_WLAN0 (0) 131 #define INSTID_WLAN1 (1) 132 #ifndef STA_INSTANCE_MAX_NUM 133 #define STA_INSTANCE_MAX_NUM (2) 134 #endif 135 136 #define WIFI_OEMINFO_MAC (1) 137 138 #endif