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