适配系统服务接口管控

Signed-off-by: CodeAdo <baliguan163@163.com>
This commit is contained in:
CodeAdo 2023-06-30 16:51:19 +08:00
parent 259d0c312d
commit 302522baa9
40 changed files with 1312 additions and 744 deletions

17
CODEOWNERS Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
# any change to wifi/frameworks/native/interfaces/wifi_manager_service_ipc_interface_code.h needs to be reviewed by @leonchan5
wifi/frameworks/native/interfaces/wifi_manager_service_ipc_interface_code.h @leonchan5

View File

@ -19,137 +19,6 @@
#include "system_ability_definition.h"
#endif
/* ------------sta module message define--------- */
#define WIFI_SVR_CMD_ENABLE_WIFI 0x1001 /* open wifi */
#define WIFI_SVR_CMD_DISABLE_WIFI 0x1002 /* close wifi */
#define WIFI_SVR_CMD_SET_POWER_MODE 0x1003 /* wifi lock, not used */
#define WIFI_SVR_CMD_FULL_SCAN 0x1004 /* scan request */
#define WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN 0X1005 /* scan with params request */
#define WIFI_SVR_CMD_ADD_DEVICE_CONFIG 0X1006 /* add a network config */
#define WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG 0X1007 /* remove a network config */
#define WIFI_SVR_CMD_GET_DEVICE_CONFIGS 0x1008 /* get current saved network configs */
#define WIFI_SVR_CMD_ENABLE_DEVICE 0X1009 /* set a network enabled */
#define WIFI_SVR_CMD_DISABLE_DEVICE 0X100A /* disabled a network */
#define WIFI_SVR_CMD_CONNECT_TO 0X100B /* connect to a network with networkid */
#define WIFI_SVR_CMD_CONNECT2_TO 0x100C /* connect to a network with network config */
#define WIFI_SVR_CMD_RECONNECT 0X100D /* reconnect */
#define WIFI_SVR_CMD_REASSOCIATE 0x100E /* reassociate */
#define WIFI_SVR_CMD_DISCONNECT 0x1010 /* disconnect */
#define WIFI_SVR_CMD_START_WPS 0x1011 /* start wps */
#define WIFI_SVR_CMD_CANCEL_WPS 0x1012 /* stop wps */
#define WIFI_SVR_CMD_IS_WIFI_ACTIVE 0x1013 /* whether current wifi active */
#define WIFI_SVR_CMD_GET_WIFI_STATE 0x1014 /* get current wifi state */
#define WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE 0x1015 /* whether set scan always */
#define WIFI_SVR_CMD_GET_SCAN_INFO_LIST 0x1016 /* get scan results */
#define WIFI_SVR_CMD_GET_LINKED_INFO 0x1017 /* get current link info */
#define WIFI_SVR_CMD_GET_DHCP_INFO 0x1018 /* get dhcp info */
#define WIFI_SVR_CMD_SET_COUNTRY_CODE 0X1019 /* set country code */
#define WIFI_SVR_CMD_GET_COUNTRY_CODE 0x101A /* get country code */
#define WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT 0x101B /* api register callback event */
#define WIFI_SVR_CMD_GET_SIGNAL_LEVEL 0x101C /* get signal level */
#define WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO 0x101D /* set scan control policy */
#define WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK 0x101E /* register scan callback */
#define WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG 0x101F /* update a network config */
#define WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG 0x1020 /* remove all network configs */
#define WIFI_SVR_CMD_GET_SUPPORTED_FEATURES 0x1021 /* get supported features */
#define WIFI_SVR_CMD_GET_DERVICE_MAC_ADD 0x1022 /* get mac address */
#define WIFI_SVR_CMD_INIT_WIFI_PROTECT 0x1023 /* init the Wi-Fi protect. */
#define WIFI_SVR_CMD_GET_WIFI_PROTECT 0x1024 /* get the Wi-Fi protect. */
#define WIFI_SVR_CMD_PUT_WIFI_PROTECT 0x1025 /* put the Wi-Fi protect. */
#define WIFI_SVR_CMD_IS_WIFI_CONNECTED 0x1026 /* is Wi-Fi connected */
#define WIFI_SVR_CMD_SET_LOW_LATENCY_MODE 0x1027 /* set low latency mode */
#define WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG 0x1028 /* remove an candidate network config */
#define WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED 0x1029 /* get taget bandtype supported */
#define WIFI_SVR_CMD_GET_5G_CHANNELLIST 0x1030 /* get 5g channellist */
#define WIFI_SVR_CMD_GET_DISCONNECTED_REASON 0x1031 /* get disconnect reason */
/* -------------ap module message define----------------- */
#define WIFI_SVR_CMD_ENABLE_WIFI_AP 0x1100 /* open ap */
#define WIFI_SVR_CMD_DISABLE_WIFI_AP 0x1101 /* close ap */
#define WIFI_SVR_CMD_GETAPSTATE_WIFI 0x1102 /* get current ap state */
#define WIFI_SVR_CMD_SETAPCONFIG_WIFI 0x1103 /* set ap config */
#define WIFI_SVR_CMD_GET_HOTSPOT_CONFIG 0x1104 /* get ap config */
#define WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE 0x1105 /* whether current ap active */
#define WIFI_SVR_CMD_GET_STATION_LIST 0x1106 /* get ap's connected sta infos */
#define WIFI_SVR_CMD_SETBAND_AP 0X1108 /* set band */
#define WIFI_SVR_CMD_GETBAND_AP 0X1109 /* get band */
#define WIFI_SVR_CMD_ADD_BLOCK_LIST 0X110A /* add a block */
#define WIFI_SVR_CMD_DEL_BLOCK_LIST 0X110B /* remove a block */
#define WIFI_SVR_CMD_GET_BLOCK_LISTS 0X110C /* get total block list */
#define WIFI_SVR_CMD_DISCONNECT_STA 0X110D /* disconnect a sta connection */
#define WIFI_SVR_CMD_GET_VALID_BANDS 0X110E /* get current valid frequency according band */
#define WIFI_SVR_CMD_GET_VALID_CHANNELS 0X110F /* get current valid channels associated with the band */
#define WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK 0X1110 /* register scan callback */
#define WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL 0X1111 /* get supported power model */
#define WIFI_SVR_CMD_GET_POWER_MODEL 0X1112 /* get power model */
#define WIFI_SVR_CMD_SET_POWER_MODEL 0X1113 /* set power model */
#define WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED 0X1114 /* whether dual band is supported */
#define WIFI_SVR_CMD_SETTIMEOUT_AP 0X1115 /* set hotspot idle timeout */
/* -------------p2p module message define----------------- */
#define WIFI_SVR_CMD_P2P_ENABLE 0x2000 /* open p2p */
#define WIFI_SVR_CMD_P2P_DISABLE 0x2001 /* close p2p */
#define WIFI_SVR_CMD_P2P_DISCOVER_DEVICES 0x2002 /* start Wi-Fi P2P device search */
#define WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES 0x2003 /* stop Wi-Fi P2P device search */
#define WIFI_SVR_CMD_P2P_DISCOVER_SERVICES 0x2004 /* start Wi-Fi P2P service search */
#define WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES 0x2005 /* stop Wi-Fi P2P service search */
#define WIFI_SVR_CMD_P2P_REQUEST_SERVICES 0x2006 /* request the P2P service */
#define WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES 0x2007 /* add local P2P service */
#define WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES 0x2008 /* remove local P2P service */
#define WIFI_SVR_CMD_P2P_START_LISTEN 0x2009 /* enable Wi-Fi P2P listening */
#define WIFI_SVR_CMD_P2P_STOP_LISTEN 0x200A /* disable Wi-Fi P2P listening */
#define WIFI_SVR_CMD_P2P_CREATE_GROUP 0x200B /* creating a P2P Group */
#define WIFI_SVR_CMD_P2P_REMOVE_GROUP 0x200C /* remove a P2P Group */
#define WIFI_SVR_CMD_P2P_DELETE_GROUP 0x200D /* delete a P2P Group */
#define WIFI_SVR_CMD_P2P_CONNECT 0x200E /* p2p connect */
#define WIFI_SVR_CMD_P2P_CANCEL_CONNECT 0x200F /* p2p cancel connect */
#define WIFI_SVR_CMD_P2P_QUERY_INFO 0x2010 /* querying Wi-Fi P2P Connection Information */
#define WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP 0x2011 /* get the P2P current group */
#define WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS 0x2012 /* obtains the P2P switch status */
#define WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS 0x2013 /* obtains the P2P discovery status */
#define WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS 0x2014 /* obtains the P2P connected status */
#define WIFI_SVR_CMD_P2P_QUERY_DEVICES 0x2015 /* query the information about the found devices */
#define WIFI_SVR_CMD_P2P_QUERY_GROUPS 0x2016 /* query the information about the found groups */
#define WIFI_SVR_CMD_P2P_QUERY_SERVICES 0x2017 /* query the information about the found services */
#define WIFI_SVR_CMD_P2P_REGISTER_CALLBACK 0x2018
#define WIFI_SVR_CMD_P2P_SET_DEVICE_NAME 0x2019 /* set device name */
#define WIFI_SVR_CMD_P2P_SET_WFD_INFO 0x201A /* set p2p wifi display info */
#define WIFI_SVR_CMD_P2P_HID2D_APPLY_IP 0x201B /* hid2d apply ip */
#define WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE 0x201C /* hid2d shared link increase */
#define WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE 0x201D /* hid2d shared link decrease */
#define WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP 0x201E /* hid2d create group */
#define WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP 0x201F /* hid2d remove GC group */
#define WIFI_SVR_CMD_P2P_HID2D_CONNECT 0x2020 /* hid2d connect to group */
#define WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP 0x2021 /* hid2d configure IP address */
#define WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP 0x2022 /* hid2d release IP address */
#define WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL 0x2023 /* get recommended channel */
#define WIFI_SVR_CMD_GET_5G_CHANNEL_LIST 0x2024 /* get recommended channel */
#define WIFI_SVR_CMD_GET_SELF_WIFI_CFG 0x2025 /* get self wifi configuration */
#define WIFI_SVR_CMD_SET_PEER_WIFI_CFG 0x2026 /* set peer wifi configuration */
#define WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE 0x2027 /* query the information about the local device */
#define WIFI_SVR_CMD_SET_UPPER_SCENE 0x2028 /* set the scene of upper layer */
/* -----------register event type and message define-------------- */
#define WIFI_CBK_CMD_STATE_CHANGE 0x1001 /* STA state change event */
#define WIFI_CBK_CMD_CONNECTION_CHANGE 0x1002 /* STA connection state change event */
#define WIFI_CBK_CMD_SCAN_STATE_CHANGE 0x1003 /* SCAN state change event */
#define WIFI_CBK_CMD_RSSI_CHANGE 0x1004 /* RSSI */
#define WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE 0x1005 /* AP state change event */
#define WIFI_CBK_CMD_HOTSPOT_STATE_JOIN 0x1006 /* AP join a sta event */
#define WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE 0x1007 /* AP leave a sta event */
#define WIFI_CBK_CMD_STREAM_DIRECTION 0x1008 /* traffic up/down state event */
#define WIFI_CBK_CMD_WPS_STATE_CHANGE 0x1009 /* wps state change event */
#define WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE 0x100A /* device config change event */
#define WIFI_CBK_CMD_P2P_STATE_CHANGE 0x1010 /* p2p state change event */
#define WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE 0x1011 /* Persistent Group Updated */
#define WIFI_CBK_CMD_THIS_DEVICE_CHANGE 0x1012 /* The current device information has been updated */
#define WIFI_CBK_CMD_PEER_CHANGE 0x1013
#define WIFI_CBK_CMD_SERVICE_CHANGE 0x1014
#define WIFI_CBK_CMD_CONNECT_CHANGE 0x1015
#define WIFI_CBK_CMD_DISCOVERY_CHANGE 0x1016
#define WIFI_CBK_CMD_P2P_ACTION_RESULT 0x1017
#define WIFI_CBK_CMD_CFG_CHANGE 0x1018
/* The response message ID of callback */
#define WIFI_CBK_MSG_STATE_CHANGE 0x1001
#define WIFI_CBK_MSG_CONNECTION_CHANGE 0x1002

View File

@ -33,9 +33,6 @@ public:
virtual sptr<IRemoteObject> GetWifiRemote(int id) = 0;
public:
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.wifi.IWifiHotspotMgr");
enum Code {
WIFI_MGR_GET_HOTSPOT_SERVICE = 0,
};
};
} // namespace Wifi
} // namespace OHOS

View File

@ -0,0 +1,171 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_WIFI_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#define OHOS_WIFI_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
namespace OHOS {
namespace Wifi {
/* SAID: 1120 */
enum class DevInterfaceCode {
WIFI_SVR_CMD_ENABLE_WIFI = 0x1001, /* open wifi */
WIFI_SVR_CMD_DISABLE_WIFI = 0x1002, /* close wifi */
WIFI_SVR_CMD_ADD_DEVICE_CONFIG = 0x1006, /* add a network config */
WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG = 0x1007, /* remove a network config */
WIFI_SVR_CMD_GET_DEVICE_CONFIGS = 0x1008, /* get current saved network configs */
WIFI_SVR_CMD_ENABLE_DEVICE = 0x1009, /* set a network enabled */
WIFI_SVR_CMD_DISABLE_DEVICE = 0x100A, /* disabled a network */
WIFI_SVR_CMD_CONNECT_TO = 0x100B, /* connect to a network with networkid */
WIFI_SVR_CMD_CONNECT2_TO = 0x100C, /* connect to a network with network config */
WIFI_SVR_CMD_RECONNECT = 0x100D, /* reconnect */
WIFI_SVR_CMD_REASSOCIATE = 0x100E, /* reassociate */
WIFI_SVR_CMD_DISCONNECT = 0x1010, /* disconnect */
WIFI_SVR_CMD_START_WPS = 0x1011, /* start wps */
WIFI_SVR_CMD_CANCEL_WPS = 0x1012, /* stop wps */
WIFI_SVR_CMD_IS_WIFI_ACTIVE = 0x1013, /* whether current wifi active */
WIFI_SVR_CMD_GET_WIFI_STATE = 0x1014, /* get current wifi state */
WIFI_SVR_CMD_GET_LINKED_INFO = 0x1017, /* get current link info */
WIFI_SVR_CMD_GET_DHCP_INFO = 0x1018, /* get dhcp info */
WIFI_SVR_CMD_SET_COUNTRY_CODE = 0x1019, /* set country code */
WIFI_SVR_CMD_GET_COUNTRY_CODE = 0x101A, /* get country code */
WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT = 0x101B, /* api register callback event */
WIFI_SVR_CMD_GET_SIGNAL_LEVEL = 0x101C, /* get signal level */
WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG = 0x101F, /* update a network config */
WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG = 0x1020, /* remove all network configs */
WIFI_SVR_CMD_GET_SUPPORTED_FEATURES = 0x1021, /* get supported features */
WIFI_SVR_CMD_GET_DERVICE_MAC_ADD = 0x1022, /* get mac address */
WIFI_SVR_CMD_INIT_WIFI_PROTECT = 0x1023, /* init the Wi-Fi protect. */
WIFI_SVR_CMD_GET_WIFI_PROTECT = 0x1024, /* get the Wi-Fi protect. */
WIFI_SVR_CMD_PUT_WIFI_PROTECT = 0x1025, /* put the Wi-Fi protect. */
WIFI_SVR_CMD_IS_WIFI_CONNECTED = 0x1026, /* is Wi-Fi connected */
WIFI_SVR_CMD_SET_LOW_LATENCY_MODE = 0x1027, /* set low latency mode */
WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG = 0x1028, /* remove an candidate network config */
WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED = 0x1029, /* get taget bandtype supported */
WIFI_SVR_CMD_GET_5G_CHANNELLIST = 0x1030, /* get 5g channellist */
WIFI_SVR_CMD_GET_DISCONNECTED_REASON = 0x1031, /* get disconnect reason */
/* 新增WIFI_SVR_CMD_类code请在此下方添加 */
/* 以下CALL BACK类code不需要进行权限校验 */
WIFI_CBK_CMD_STATE_CHANGE = 0x3000, /* STA state change event */
WIFI_CBK_CMD_CONNECTION_CHANGE = 0x3001, /* STA connection state change event */
WIFI_CBK_CMD_RSSI_CHANGE = 0x3002, /* RSSI */
WIFI_CBK_CMD_STREAM_DIRECTION = 0x3003, /* traffic up/down state event */
WIFI_CBK_CMD_WPS_STATE_CHANGE = 0x3004, /* wps state change event */
WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE = 0x3005, /* device config change event */
};
/* SAID: 1121 */
enum class HotspotInterfaceCode {
WIFI_MGR_GET_HOTSPOT_SERVICE = 0,
WIFI_SVR_CMD_ENABLE_WIFI_AP = 0x1100, /* open ap */
WIFI_SVR_CMD_DISABLE_WIFI_AP = 0x1101, /* close ap */
WIFI_SVR_CMD_GETAPSTATE_WIFI = 0x1102, /* get current ap state */
WIFI_SVR_CMD_SETAPCONFIG_WIFI = 0x1103, /* set ap config */
WIFI_SVR_CMD_GET_HOTSPOT_CONFIG = 0x1104, /* get ap config */
WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE = 0x1105, /* whether current ap active */
WIFI_SVR_CMD_GET_STATION_LIST = 0x1106, /* get ap's connected sta infos */
WIFI_SVR_CMD_ADD_BLOCK_LIST = 0x110A, /* add a block */
WIFI_SVR_CMD_DEL_BLOCK_LIST = 0x110B, /* remove a block */
WIFI_SVR_CMD_GET_BLOCK_LISTS = 0x110C, /* get total block list */
WIFI_SVR_CMD_DISCONNECT_STA = 0x110D, /* disconnect a sta connection */
WIFI_SVR_CMD_GET_VALID_BANDS = 0x110E, /* get current valid frequency according band */
WIFI_SVR_CMD_GET_VALID_CHANNELS = 0x110F, /* get current valid channels associated with the band */
WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK = 0x1110, /* register scan callback */
WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL = 0x1111, /* get supported power model */
WIFI_SVR_CMD_GET_POWER_MODEL = 0x1112, /* get power model */
WIFI_SVR_CMD_SET_POWER_MODEL = 0x1113, /* set power model */
WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED = 0x1114, /* whether dual band is supported */
WIFI_SVR_CMD_SETTIMEOUT_AP = 0x1115, /* set hotspot idle timeout */
/* 新增WIFI_SVR_CMD_类code请在此下方添加 */
/* 以下CALL BACK类code不需要进行权限校验 */
WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE = 0x3100, /* AP state change event */
WIFI_CBK_CMD_HOTSPOT_STATE_JOIN = 0x3101, /* AP join a sta event */
WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE = 0x3102, /* AP leave a sta event */
};
/* SAID: 1123 */
enum class P2PInterfaceCode {
WIFI_SVR_CMD_P2P_ENABLE = 0x2000, /* open p2p */
WIFI_SVR_CMD_P2P_DISABLE = 0x2001, /* close p2p */
WIFI_SVR_CMD_P2P_DISCOVER_DEVICES = 0x2002, /* start Wi-Fi P2P device search */
WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES = 0x2003, /* stop Wi-Fi P2P device search */
WIFI_SVR_CMD_P2P_DISCOVER_SERVICES = 0x2004, /* start Wi-Fi P2P service search */
WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES = 0x2005, /* stop Wi-Fi P2P service search */
WIFI_SVR_CMD_P2P_REQUEST_SERVICES = 0x2006, /* request the P2P service */
WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES = 0x2007, /* add local P2P service */
WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES = 0x2008, /* remove local P2P service */
WIFI_SVR_CMD_P2P_START_LISTEN = 0x2009, /* enable Wi-Fi P2P listening */
WIFI_SVR_CMD_P2P_STOP_LISTEN = 0x200A, /* disable Wi-Fi P2P listening */
WIFI_SVR_CMD_P2P_CREATE_GROUP = 0x200B, /* creating a P2P Group */
WIFI_SVR_CMD_P2P_REMOVE_GROUP = 0x200C, /* remove a P2P Group */
WIFI_SVR_CMD_P2P_DELETE_GROUP = 0x200D, /* delete a P2P Group */
WIFI_SVR_CMD_P2P_CONNECT = 0x200E, /* p2p connect */
WIFI_SVR_CMD_P2P_CANCEL_CONNECT = 0x200F, /* p2p cancel connect */
WIFI_SVR_CMD_P2P_QUERY_INFO = 0x2010, /* querying Wi-Fi P2P Connection Information */
WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP = 0x2011, /* get the P2P current group */
WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS = 0x2012, /* obtains the P2P switch status */
WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS = 0x2013, /* obtains the P2P discovery status */
WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS = 0x2014, /* obtains the P2P connected status */
WIFI_SVR_CMD_P2P_QUERY_DEVICES = 0x2015, /* query the information about the found devices */
WIFI_SVR_CMD_P2P_QUERY_GROUPS = 0x2016, /* query the information about the found groups */
WIFI_SVR_CMD_P2P_QUERY_SERVICES = 0x2017, /* query the information about the found services */
WIFI_SVR_CMD_P2P_REGISTER_CALLBACK = 0x2018,
WIFI_SVR_CMD_P2P_SET_DEVICE_NAME = 0x2019, /* set device name */
WIFI_SVR_CMD_P2P_SET_WFD_INFO = 0x201A, /* set p2p wifi display info */
WIFI_SVR_CMD_P2P_HID2D_APPLY_IP = 0x201B, /* hid2d apply ip */
WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE = 0x201C, /* hid2d shared link increase */
WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE = 0x201D, /* hid2d shared link decrease */
WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP = 0x201E, /* hid2d create group */
WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP = 0x201F, /* hid2d remove GC group */
WIFI_SVR_CMD_P2P_HID2D_CONNECT = 0x2020, /* hid2d connect to group */
WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP = 0x2021, /* hid2d configure IP address */
WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP = 0x2022, /* hid2d release IP address */
WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL = 0x2023, /* get recommended channel */
WIFI_SVR_CMD_GET_5G_CHANNEL_LIST = 0x2024, /* get recommended channel */
WIFI_SVR_CMD_GET_SELF_WIFI_CFG = 0x2025, /* get self wifi configuration */
WIFI_SVR_CMD_SET_PEER_WIFI_CFG = 0x2026, /* set peer wifi configuration */
WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE = 0x2027, /* query the information about the local device */
WIFI_SVR_CMD_SET_UPPER_SCENE = 0x2028, /* set the scene of upper layer */
/* 新增WIFI_SVR_CMD_类code请在此下方添加 */
/* 以下CALL BACK类code不需要进行权限校验 */
WIFI_CBK_CMD_P2P_STATE_CHANGE = 0x3200, /* p2p state change event */
WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE = 0x3201, /* Persistent Group Updated */
WIFI_CBK_CMD_THIS_DEVICE_CHANGE = 0x3202, /* The current device information has been updated */
WIFI_CBK_CMD_PEER_CHANGE = 0x3203,
WIFI_CBK_CMD_SERVICE_CHANGE = 0x3204,
WIFI_CBK_CMD_CONNECT_CHANGE = 0x3205,
WIFI_CBK_CMD_DISCOVERY_CHANGE = 0x3206,
WIFI_CBK_CMD_P2P_ACTION_RESULT = 0x3207,
WIFI_CBK_CMD_CFG_CHANGE = 0x3208,
};
/* SAID: 1124 */
enum class ScanInterfaceCode {
WIFI_SVR_CMD_FULL_SCAN = 0x1004, /* scan request */
WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN = 0x1005, /* scan with params request */
WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE = 0x1015, /* whether set scan always */
WIFI_SVR_CMD_GET_SCAN_INFO_LIST = 0x1016, /* get scan results */
WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO = 0x101D, /* set scan control policy */
WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK = 0x101E, /* register scan callback */
/* 新增WIFI_SVR_CMD_类code请在此下方添加 */
/* 以下CALL BACK类code不需要进行权限校验 */
WIFI_CBK_CMD_SCAN_STATE_CHANGE = 0x3300, /* SCAN state change event */
};
} // namespace wifi
} // namespace OHOS
#endif // end of OHOS_WIFI_MANAGER_SERVICE_IPC_INTERFACE_CODE_H

View File

@ -14,6 +14,7 @@
*/
#include "wifi_device_callback_stub.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_hisysevent.h"
#include "wifi_logger.h"
#include "wifi_msg.h"
@ -46,27 +47,27 @@ int WifiDeviceCallBackStub::OnRemoteRequest(
}
int ret = -1;
switch (code) {
case WIFI_CBK_CMD_STATE_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE): {
ret = RemoteOnWifiStateChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_CONNECTION_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE): {
ret = RemoteOnWifiConnectionChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_RSSI_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE): {
ret = RemoteOnWifiRssiChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_WPS_STATE_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE): {
ret = RemoteOnWifiWpsStateChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_STREAM_DIRECTION: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION): {
ret = RemoteOnStreamChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE): {
ret = RemoteOnDeviceConfigChanged(code, data, reply);
break;
}

View File

@ -14,6 +14,7 @@
*/
#include "wifi_device_callback_stub_lite.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_logger.h"
#include "wifi_msg.h"
#include "wifi_errcode.h"
@ -62,27 +63,27 @@ int WifiDeviceCallBackStub::OnRemoteRequest(uint32_t code, IpcIo *data)
return ret;
}
switch (code) {
case WIFI_CBK_CMD_STATE_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE): {
ret = RemoteOnWifiStateChanged(code, data);
break;
}
case WIFI_CBK_CMD_CONNECTION_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE): {
ret = RemoteOnWifiConnectionChanged(code, data);
break;
}
case WIFI_CBK_CMD_RSSI_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE): {
ret = RemoteOnWifiRssiChanged(code, data);
break;
}
case WIFI_CBK_CMD_WPS_STATE_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE): {
ret = RemoteOnWifiWpsStateChanged(code, data);
break;
}
case WIFI_CBK_CMD_STREAM_DIRECTION: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION): {
ret = RemoteOnStreamChanged(code, data);
break;
}
case WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE): {
ret = RemoteOnDeviceConfigChanged(code, data);
break;
}

View File

@ -15,6 +15,7 @@
#include "wifi_device_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_common_util.h"
#include "wifi_device_callback_stub.h"
#include "wifi_hisysevent.h"
@ -85,9 +86,11 @@ ErrCode WifiDeviceProxy::EnableWifi()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_ENABLE_WIFI, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ENABLE_WIFI, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI), error);
return WIFI_OPT_FAILED;
}
@ -112,9 +115,11 @@ ErrCode WifiDeviceProxy::DisableWifi()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_DISABLE_WIFI, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISABLE_WIFI, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -140,9 +145,11 @@ ErrCode WifiDeviceProxy::InitWifiProtect(const WifiProtectType &protectType, con
data.WriteInt32(0);
data.WriteInt32((int)protectType);
data.WriteCString(protectName.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_INIT_WIFI_PROTECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_INIT_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -172,9 +179,11 @@ ErrCode WifiDeviceProxy::GetWifiProtectRef(const WifiProtectMode &protectMode, c
data.WriteInt32(0);
data.WriteInt32((int)protectMode);
data.WriteCString(protectName.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_WIFI_PROTECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -203,9 +212,11 @@ ErrCode WifiDeviceProxy::PutWifiProtectRef(const std::string &protectName)
}
data.WriteInt32(0);
data.WriteCString(protectName.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_PUT_WIFI_PROTECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_PUT_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -293,9 +304,11 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(const WifiDeviceConfig &config)
/* Write a flag: 1-remove config by networkId, 2-remove config by WifiDeviceConfig */
data.WriteInt32(2);
WriteDeviceConfig(config, data);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error=%{public}d", WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error=%{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -326,9 +339,11 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(int networkId)
/* Write a flag: 1-remove config by networkId, 2-remove config by WifiDeviceConfig */
data.WriteInt32(1);
data.WriteInt32(networkId);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error=%{public}d", WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error=%{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -354,9 +369,11 @@ ErrCode WifiDeviceProxy::AddDeviceConfig(const WifiDeviceConfig &config, int &re
/* true-candidate config, false-normal config */
data.WriteBool(isCandidate);
WriteDeviceConfig(config, data);
int error = Remote()->SendRequest(WIFI_SVR_CMD_ADD_DEVICE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ADD_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -387,9 +404,11 @@ ErrCode WifiDeviceProxy::UpdateDeviceConfig(const WifiDeviceConfig &config, int
}
data.WriteInt32(0);
WriteDeviceConfig(config, data);
int error = Remote()->SendRequest(WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -418,9 +437,11 @@ ErrCode WifiDeviceProxy::RemoveDevice(int networkId)
}
data.WriteInt32(0);
data.WriteInt32(networkId);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -444,9 +465,11 @@ ErrCode WifiDeviceProxy::RemoveAllDevice()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
@ -544,9 +567,11 @@ ErrCode WifiDeviceProxy::GetDeviceConfigs(std::vector<WifiDeviceConfig> &result,
data.WriteInt32(0);
/* true-candidate config, false-normal config */
data.WriteBool(isCandidate);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_DEVICE_CONFIGS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_DEVICE_CONFIGS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -577,9 +602,11 @@ ErrCode WifiDeviceProxy::EnableDeviceConfig(int networkId, bool attemptEnable)
data.WriteInt32(0);
data.WriteInt32(networkId);
data.WriteInt32(attemptEnable);
int error = Remote()->SendRequest(WIFI_SVR_CMD_ENABLE_DEVICE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ENABLE_DEVICE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -603,9 +630,11 @@ ErrCode WifiDeviceProxy::DisableDeviceConfig(int networkId)
}
data.WriteInt32(0);
data.WriteInt32(networkId);
int error = Remote()->SendRequest(WIFI_SVR_CMD_DISABLE_DEVICE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISABLE_DEVICE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -631,9 +660,11 @@ ErrCode WifiDeviceProxy::ConnectToNetwork(int networkId, bool isCandidate)
/* true-candidate config, false-normal config */
data.WriteBool(isCandidate);
data.WriteInt32(networkId);
int error = Remote()->SendRequest(WIFI_SVR_CMD_CONNECT_TO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CONNECT_TO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -657,9 +688,11 @@ ErrCode WifiDeviceProxy::ConnectToDevice(const WifiDeviceConfig &config)
}
data.WriteInt32(0);
WriteDeviceConfig(config, data);
int error = Remote()->SendRequest(WIFI_SVR_CMD_CONNECT2_TO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CONNECT2_TO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -682,9 +715,11 @@ ErrCode WifiDeviceProxy::IsConnected(bool &isConnected)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_IS_WIFI_CONNECTED, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_IS_WIFI_CONNECTED, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -712,9 +747,11 @@ ErrCode WifiDeviceProxy::ReConnect()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_RECONNECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_RECONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -737,9 +774,11 @@ ErrCode WifiDeviceProxy::ReAssociate(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REASSOCIATE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REASSOCIATE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -762,9 +801,11 @@ ErrCode WifiDeviceProxy::Disconnect(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_DISCONNECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISCONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -790,9 +831,11 @@ ErrCode WifiDeviceProxy::StartWps(const WpsConfig &config)
data.WriteInt32(static_cast<int>(config.setup));
data.WriteCString(config.pin.c_str());
data.WriteCString(config.bssid.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_START_WPS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_START_WPS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -815,9 +858,11 @@ ErrCode WifiDeviceProxy::CancelWps(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_CANCEL_WPS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CANCEL_WPS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -840,9 +885,11 @@ ErrCode WifiDeviceProxy::IsWifiActive(bool &bActive)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_IS_WIFI_ACTIVE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_IS_WIFI_ACTIVE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -871,9 +918,11 @@ ErrCode WifiDeviceProxy::GetWifiState(int &state)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_WIFI_STATE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_WIFI_STATE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -952,10 +1001,11 @@ ErrCode WifiDeviceProxy::GetDisconnectedReason(DisconnectedReason &reason)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_DISCONNECTED_REASON, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DISCONNECTED_REASON),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_DISCONNECTED_REASON, error);
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DISCONNECTED_REASON), error);
return WIFI_OPT_FAILED;
}
@ -989,9 +1039,11 @@ ErrCode WifiDeviceProxy::GetLinkedInfo(WifiLinkedInfo &info)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_LINKED_INFO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_LINKED_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO), error);
return WIFI_OPT_FAILED;
}
@ -1021,9 +1073,11 @@ ErrCode WifiDeviceProxy::GetIpInfo(IpInfo &info)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_DHCP_INFO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_DHCP_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1059,9 +1113,11 @@ ErrCode WifiDeviceProxy::SetCountryCode(const std::string &countryCode)
}
data.WriteInt32(0);
data.WriteString(countryCode);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_COUNTRY_CODE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_SET_COUNTRY_CODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1084,9 +1140,11 @@ ErrCode WifiDeviceProxy::GetCountryCode(std::string &countryCode)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_COUNTRY_CODE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_COUNTRY_CODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1137,9 +1195,11 @@ ErrCode WifiDeviceProxy::RegisterCallBack(const sptr<IWifiDeviceCallBack> &callb
}
}
WIFI_LOGD("%{public}s, calling uid: %{public}d, pid: %{public}d", __func__, GetCallingUid(), pid);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed, code is %{public}d", WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT, error);
WIFI_LOGE("Set Attr(%{public}d) failed, code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1164,9 +1224,11 @@ ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &l
data.WriteInt32(0);
data.WriteInt32(rssi);
data.WriteInt32(band);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SIGNAL_LEVEL, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SIGNAL_LEVEL, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1195,9 +1257,11 @@ ErrCode WifiDeviceProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1228,9 +1292,11 @@ ErrCode WifiDeviceProxy::GetDeviceMacAddress(std::string &result)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_DERVICE_MAC_ADD, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_DERVICE_MAC_ADD);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD));
return WIFI_OPT_FAILED;
}
@ -1262,9 +1328,11 @@ bool WifiDeviceProxy::SetLowLatencyMode(bool enabled)
}
data.WriteInt32(0);
data.WriteBool(enabled);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_LOW_LATENCY_MODE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_SET_LOW_LATENCY_MODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1310,10 +1378,11 @@ ErrCode WifiDeviceProxy::IsBandTypeSupported(int bandType, bool &supported)
}
data.WriteInt32(0);
data.WriteInt32(bandType);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("IsBandTypeSupported (%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED, error);
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED), error);
return WIFI_OPT_FAILED;
}
@ -1342,10 +1411,11 @@ ErrCode WifiDeviceProxy::Get5GHzChannelList(std::vector<int> &result)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_5G_CHANNELLIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Get5GHzChannelList(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_5G_CHANNELLIST, error);
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST), error);
return WIFI_OPT_FAILED;
}

View File

@ -15,6 +15,7 @@
#include "wifi_device_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "serializer.h"
@ -202,48 +203,48 @@ static int IpcCallback(void *owner, int code, IpcIo *reply)
}
switch (data->funcId) {
case WIFI_SVR_CMD_ADD_DEVICE_CONFIG:
case WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG:
case WIFI_SVR_CMD_GET_WIFI_STATE:
case WIFI_SVR_CMD_GET_SIGNAL_LEVEL: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL): {
(void)ReadInt32(reply, (int32_t *)data->variable);
break;
}
case WIFI_SVR_CMD_IS_WIFI_CONNECTED:
case WIFI_SVR_CMD_IS_WIFI_ACTIVE:
case WIFI_SVR_CMD_SET_LOW_LATENCY_MODE: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE): {
(void)ReadBool(reply, (bool *)data->variable);
break;
}
case WIFI_SVR_CMD_GET_COUNTRY_CODE:
case WIFI_SVR_CMD_GET_DERVICE_MAC_ADD: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE):
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD): {
size_t readLen = 0;
*((std::string *)data->variable) = (char *)ReadString(reply, &readLen);
break;
}
case WIFI_SVR_CMD_GET_SUPPORTED_FEATURES: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES): {
int64_t features = 0;
ReadInt64(reply, &features);
*((long *)data->variable) = features;
break;
}
case WIFI_SVR_CMD_GET_DEVICE_CONFIGS: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS): {
ParseDeviceConfigs(reply, *((std::vector<WifiDeviceConfig> *)data->variable));
break;
}
case WIFI_SVR_CMD_GET_LINKED_INFO: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO): {
ReadLinkedInfo(reply, *((WifiLinkedInfo *)data->variable));
break;
}
case WIFI_SVR_CMD_GET_DHCP_INFO: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO): {
ReadDhcpInfo(reply, *((IpInfo *)data->variable));
break;
}
case WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED): {
(void)ReadBool(reply, (bool *)data->variable);
break;
}
case WIFI_SVR_CMD_GET_5G_CHANNELLIST: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST): {
Parse5GChannels(reply, *((std::vector<int> *)data->variable));
break;
}
@ -342,10 +343,12 @@ ErrCode WifiDeviceProxy::EnableWifi()
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_ENABLE_WIFI;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_ENABLE_WIFI, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ENABLE_WIFI, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI), error);
return WIFI_OPT_FAILED;
}
@ -373,10 +376,12 @@ ErrCode WifiDeviceProxy::DisableWifi()
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_DISABLE_WIFI;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_DISABLE_WIFI, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISABLE_WIFI, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI), error);
return WIFI_OPT_FAILED;
}
@ -406,10 +411,12 @@ ErrCode WifiDeviceProxy::InitWifiProtect(const WifiProtectType &protectType, con
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, (int)protectType);
(void)WriteString(&req, protectName.c_str());
owner.funcId = WIFI_SVR_CMD_INIT_WIFI_PROTECT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_INIT_WIFI_PROTECT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_INIT_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT), error);
return ErrCode(error);
}
@ -439,10 +446,12 @@ ErrCode WifiDeviceProxy::GetWifiProtectRef(const WifiProtectMode &protectMode, c
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, (int)protectMode);
(void)WriteString(&req, protectName.c_str());
owner.funcId = WIFI_SVR_CMD_GET_WIFI_PROTECT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_WIFI_PROTECT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT), error);
return ErrCode(error);
}
@ -471,10 +480,12 @@ ErrCode WifiDeviceProxy::PutWifiProtectRef(const std::string &protectName)
}
(void)WriteInt32(&req, 0);
(void)WriteString(&req, protectName.c_str());
owner.funcId = WIFI_SVR_CMD_PUT_WIFI_PROTECT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_PUT_WIFI_PROTECT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_PUT_WIFI_PROTECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT), error);
return ErrCode(error);
}
@ -569,10 +580,12 @@ ErrCode WifiDeviceProxy::AddDeviceConfig(const WifiDeviceConfig &config, int &re
(void)WriteBool(&req, isCandidate);
WriteDeviceConfig(config, req);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_ADD_DEVICE_CONFIG;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_ADD_DEVICE_CONFIG, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ADD_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
@ -602,10 +615,12 @@ ErrCode WifiDeviceProxy::UpdateDeviceConfig(const WifiDeviceConfig &config, int
(void)WriteInt32(&req, 0);
WriteDeviceConfig(config, req);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
@ -634,10 +649,12 @@ ErrCode WifiDeviceProxy::RemoveDevice(int networkId)
}
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, networkId);
owner.funcId = WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
@ -665,10 +682,12 @@ ErrCode WifiDeviceProxy::RemoveAllDevice()
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG), error);
return WIFI_OPT_FAILED;
}
@ -698,10 +717,12 @@ ErrCode WifiDeviceProxy::GetDeviceConfigs(std::vector<WifiDeviceConfig> &result,
(void)WriteInt32(&req, 0);
(void)WriteBool(&req, isCandidate);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_GET_DEVICE_CONFIGS;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_DEVICE_CONFIGS, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_DEVICE_CONFIGS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS), error);
return WIFI_OPT_FAILED;
}
@ -732,10 +753,12 @@ ErrCode WifiDeviceProxy::EnableDeviceConfig(int networkId, bool attemptEnable)
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, networkId);
(void)WriteInt32(&req, attemptEnable);
owner.funcId = WIFI_SVR_CMD_ENABLE_DEVICE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_ENABLE_DEVICE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_ENABLE_DEVICE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE), error);
return WIFI_OPT_FAILED;
}
@ -764,10 +787,12 @@ ErrCode WifiDeviceProxy::DisableDeviceConfig(int networkId)
}
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, networkId);
owner.funcId = WIFI_SVR_CMD_DISABLE_DEVICE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_DISABLE_DEVICE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISABLE_DEVICE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE), error);
return WIFI_OPT_FAILED;
}
@ -797,10 +822,12 @@ ErrCode WifiDeviceProxy::ConnectToNetwork(int networkId, bool isCandidate)
(void)WriteInt32(&req, 0);
(void)WriteBool(&req, isCandidate);
(void)WriteInt32(&req, networkId);
owner.funcId = WIFI_SVR_CMD_CONNECT_TO;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_CONNECT_TO, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CONNECT_TO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO), error);
return WIFI_OPT_FAILED;
}
@ -829,10 +856,12 @@ ErrCode WifiDeviceProxy::ConnectToDevice(const WifiDeviceConfig &config)
}
(void)WriteInt32(&req, 0);
WriteDeviceConfig(config, req);
owner.funcId = WIFI_SVR_CMD_CONNECT2_TO;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_CONNECT2_TO, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CONNECT2_TO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO), error);
return WIFI_OPT_FAILED;
}
@ -860,10 +889,12 @@ ErrCode WifiDeviceProxy::IsConnected(bool &isConnected)
}
(void)WriteInt32(&req, 0);
owner.variable = &isConnected;
owner.funcId = WIFI_SVR_CMD_IS_WIFI_CONNECTED;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_IS_WIFI_CONNECTED, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_IS_WIFI_CONNECTED, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED), error);
return WIFI_OPT_FAILED;
}
@ -891,10 +922,12 @@ ErrCode WifiDeviceProxy::ReConnect()
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_RECONNECT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_RECONNECT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_RECONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT), error);
return WIFI_OPT_FAILED;
}
@ -922,10 +955,12 @@ ErrCode WifiDeviceProxy::ReAssociate(void)
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_REASSOCIATE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_REASSOCIATE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE);
int error = remote_->Invoke(remote_,
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE), &req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_REASSOCIATE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE), error);
return WIFI_OPT_FAILED;
}
@ -953,10 +988,12 @@ ErrCode WifiDeviceProxy::Disconnect(void)
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_DISCONNECT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_DISCONNECT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_DISCONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT), error);
return WIFI_OPT_FAILED;
}
@ -987,10 +1024,12 @@ ErrCode WifiDeviceProxy::StartWps(const WpsConfig &config)
(void)WriteInt32(&req, static_cast<int>(config.setup));
(void)WriteString(&req, config.pin.c_str());
(void)WriteString(&req, config.bssid.c_str());
owner.funcId = WIFI_SVR_CMD_START_WPS;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_START_WPS, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_START_WPS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS), error);
return WIFI_OPT_FAILED;
}
@ -1018,10 +1057,12 @@ ErrCode WifiDeviceProxy::CancelWps(void)
return WIFI_OPT_FAILED;
}
(void)WriteInt32(&req, 0);
owner.funcId = WIFI_SVR_CMD_CANCEL_WPS;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_CANCEL_WPS, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS), &req, &owner,
IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_CANCEL_WPS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS), error);
return WIFI_OPT_FAILED;
}
@ -1050,10 +1091,12 @@ ErrCode WifiDeviceProxy::IsWifiActive(bool &bActive)
}
(void)WriteInt32(&req, 0);
owner.variable = &bActive;
owner.funcId = WIFI_SVR_CMD_IS_WIFI_ACTIVE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_IS_WIFI_ACTIVE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_IS_WIFI_ACTIVE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE), error);
return WIFI_OPT_FAILED;
}
@ -1082,10 +1125,12 @@ ErrCode WifiDeviceProxy::GetWifiState(int &state)
}
(void)WriteInt32(&req, 0);
owner.variable = &state;
owner.funcId = WIFI_SVR_CMD_GET_WIFI_STATE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_WIFI_STATE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_WIFI_STATE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE), error);
return WIFI_OPT_FAILED;
}
@ -1114,10 +1159,12 @@ ErrCode WifiDeviceProxy::GetLinkedInfo(WifiLinkedInfo &info)
}
(void)WriteInt32(&req, 0);
owner.variable = &info;
owner.funcId = WIFI_SVR_CMD_GET_LINKED_INFO;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_LINKED_INFO, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_LINKED_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO), error);
return WIFI_OPT_FAILED;
}
@ -1146,10 +1193,12 @@ ErrCode WifiDeviceProxy::GetIpInfo(IpInfo &info)
}
(void)WriteInt32(&req, 0);
owner.variable = &info;
owner.funcId = WIFI_SVR_CMD_GET_DHCP_INFO;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_DHCP_INFO, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_DHCP_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO), error);
return WIFI_OPT_FAILED;
}
@ -1178,10 +1227,12 @@ ErrCode WifiDeviceProxy::SetCountryCode(const std::string &countryCode)
}
(void)WriteInt32(&req, 0);
(void)WriteString(&req, countryCode.c_str());
owner.funcId = WIFI_SVR_CMD_SET_COUNTRY_CODE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_SET_COUNTRY_CODE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_SET_COUNTRY_CODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE), error);
return WIFI_OPT_FAILED;
}
@ -1210,10 +1261,12 @@ ErrCode WifiDeviceProxy::GetCountryCode(std::string &countryCode)
}
(void)WriteInt32(&req, 0);
owner.variable = &countryCode;
owner.funcId = WIFI_SVR_CMD_GET_COUNTRY_CODE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_COUNTRY_CODE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_COUNTRY_CODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE), error);
return WIFI_OPT_FAILED;
}
@ -1262,10 +1315,12 @@ ErrCode WifiDeviceProxy::RegisterCallBack(const std::shared_ptr<IWifiDeviceCallB
(void)WriteString(&req, eventName.c_str());
}
}
owner.funcId = WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed, code is %{public}d", WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT, error);
WIFI_LOGE("Set Attr(%{public}d) failed, code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT), error);
return WIFI_OPT_FAILED;
}
@ -1297,10 +1352,12 @@ ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &l
(void)WriteInt32(&req, rssi);
(void)WriteInt32(&req, band);
owner.variable = &level;
owner.funcId = WIFI_SVR_CMD_GET_SIGNAL_LEVEL;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_SIGNAL_LEVEL, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SIGNAL_LEVEL, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL), error);
return WIFI_OPT_FAILED;
}
@ -1329,10 +1386,12 @@ ErrCode WifiDeviceProxy::GetSupportedFeatures(long &features)
}
(void)WriteInt32(&req, 0);
owner.variable = &features;
owner.funcId = WIFI_SVR_CMD_GET_SUPPORTED_FEATURES;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return WIFI_OPT_FAILED;
}
@ -1361,10 +1420,12 @@ ErrCode WifiDeviceProxy::GetDeviceMacAddress(std::string &result)
}
(void)WriteInt32(&req, 0);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_GET_DERVICE_MAC_ADD;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_DERVICE_MAC_ADD, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_DERVICE_MAC_ADD);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD));
return WIFI_OPT_FAILED;
}
@ -1395,10 +1456,12 @@ bool WifiDeviceProxy::SetLowLatencyMode(bool enabled)
(void)WriteInt32(&req, 0);
(void)WriteBool(&req, enabled);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_SET_LOW_LATENCY_MODE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_SET_LOW_LATENCY_MODE, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_SET_LOW_LATENCY_MODE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE), error);
return WIFI_OPT_FAILED;
}
@ -1434,11 +1497,12 @@ ErrCode WifiDeviceProxy::IsBandTypeSupported(int bandType, bool &supported)
(void)WriteInt32(&req, 0);
(void)WriteInt32(&req, bandType);
owner.variable = &supported;
owner.funcId = WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED),
&req, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("IsBandTypeSupported (%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED, error);
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED), error);
return WIFI_OPT_FAILED;
}
@ -1468,11 +1532,12 @@ ErrCode WifiDeviceProxy::Get5GHzChannelList(std::vector<int> &result)
}
(void)WriteInt32(&req, 0);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_GET_5G_CHANNELLIST;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_5G_CHANNELLIST, &req, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST), &req,
&owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Get5GHzChannelList(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_5G_CHANNELLIST, error);
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST), error);
return WIFI_OPT_FAILED;
}

View File

@ -15,6 +15,7 @@
#include "wifi_hotspot_callback_stub.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_hisysevent.h"
#include "wifi_logger.h"
#include "wifi_msg.h"
@ -44,15 +45,15 @@ int WifiHotspotCallbackStub::OnRemoteRequest(
}
int ret = -1;
switch (code) {
case WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE: {
case static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE): {
ret = RemoteOnHotspotStateChanged(code, data, reply);
break;
}
case WIFI_CBK_CMD_HOTSPOT_STATE_JOIN: {
case static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_JOIN): {
ret = RemoteOnHotspotStaJoin(code, data, reply);
break;
}
case WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE: {
case static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE): {
ret = RemoteOnHotspotStaLeave(code, data, reply);
break;
}

View File

@ -18,6 +18,7 @@
#include "message_option.h"
#include "message_parcel.h"
#include "wifi_logger.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspotMgrProxy");
namespace OHOS {
@ -32,7 +33,8 @@ sptr<IRemoteObject> WifiHotspotMgrProxy::GetWifiRemote(int id)
return nullptr;
}
data.WriteInt32(id);
int error = Remote()->SendRequest(WIFI_MGR_GET_HOTSPOT_SERVICE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_MGR_GET_HOTSPOT_SERVICE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Get remote object id %{public}d failed,error code is %{public}d", id, error);
return nullptr;

View File

@ -20,6 +20,7 @@
#include "wifi_hisysevent.h"
#include "wifi_hotspot_callback_stub.h"
#include "wifi_logger.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspotProxy");
namespace OHOS {
@ -85,9 +86,11 @@ ErrCode WifiHotspotProxy::IsHotspotActive(bool &isActive)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -116,9 +119,11 @@ ErrCode WifiHotspotProxy::IsHotspotDualBandSupported(bool &isSupported)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED, data, reply, option);
int error = Remote()->SendRequest(
static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED), data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -148,9 +153,11 @@ ErrCode WifiHotspotProxy::GetHotspotState(int &state)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GETAPSTATE_WIFI, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GETAPSTATE_WIFI), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GETAPSTATE_WIFI);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GETAPSTATE_WIFI));
return WIFI_OPT_FAILED;
}
@ -181,9 +188,11 @@ ErrCode WifiHotspotProxy::GetHotspotConfig(HotspotConfig &result)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_HOTSPOT_CONFIG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_HOTSPOT_CONFIG),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_HOTSPOT_CONFIG);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_HOTSPOT_CONFIG));
return WIFI_OPT_FAILED;
}
@ -228,9 +237,12 @@ ErrCode WifiHotspotProxy::SetHotspotConfig(const HotspotConfig &config)
data.WriteInt32(config.GetChannel());
data.WriteCString(config.GetPreSharedKey().c_str());
data.WriteInt32(config.GetMaxConn());
int error = Remote()->SendRequest(WIFI_SVR_CMD_SETAPCONFIG_WIFI, data, reply, option);
data.WriteString(config.GetIpAddress());
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETAPCONFIG_WIFI),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SETAPCONFIG_WIFI);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETAPCONFIG_WIFI));
return WIFI_OPT_FAILED;
}
@ -256,9 +268,11 @@ ErrCode WifiHotspotProxy::SetHotspotIdleTimeout(int time)
}
data.WriteInt32(0);
data.WriteInt32(time);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SETTIMEOUT_AP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETTIMEOUT_AP),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{private}d) failed,error code is %{private}d", WIFI_SVR_CMD_SETTIMEOUT_AP, error);
WIFI_LOGE("Set Attr(%{private}d) failed,error code is %{private}d",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETTIMEOUT_AP), error);
return WIFI_OPT_FAILED;
}
@ -288,9 +302,11 @@ ErrCode WifiHotspotProxy::GetStationList(std::vector<StationInfo> &result)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_STATION_LIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_STATION_LIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_STATION_LIST);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_STATION_LIST));
return WIFI_OPT_FAILED;
}
@ -339,9 +355,11 @@ ErrCode WifiHotspotProxy::DisassociateSta(const StationInfo &info)
data.WriteCString(info.deviceName.c_str());
data.WriteCString(info.bssid.c_str());
data.WriteCString(info.ipAddr.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_DISCONNECT_STA, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISCONNECT_STA), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_DISCONNECT_STA);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISCONNECT_STA));
return WIFI_OPT_FAILED;
}
@ -363,9 +381,11 @@ ErrCode WifiHotspotProxy::EnableHotspot(const ServiceType type)
}
data.WriteInt32(0);
data.WriteInt32(static_cast<int>(type));
int error = Remote()->SendRequest(WIFI_SVR_CMD_ENABLE_WIFI_AP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI_AP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_ENABLE_WIFI_AP);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI_AP));
return WIFI_OPT_FAILED;
}
@ -392,9 +412,11 @@ ErrCode WifiHotspotProxy::DisableHotspot(const ServiceType type)
}
data.WriteInt32(0);
data.WriteInt32(static_cast<int>(type));
int error = Remote()->SendRequest(WIFI_SVR_CMD_DISABLE_WIFI_AP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI_AP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_DISABLE_WIFI_AP);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI_AP));
return WIFI_OPT_FAILED;
}
@ -421,9 +443,11 @@ ErrCode WifiHotspotProxy::GetBlockLists(std::vector<StationInfo> &infos)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_BLOCK_LISTS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_BLOCK_LISTS), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_BLOCK_LISTS);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_BLOCK_LISTS));
return WIFI_OPT_FAILED;
}
@ -473,9 +497,11 @@ ErrCode WifiHotspotProxy::AddBlockList(const StationInfo &info)
data.WriteCString(info.deviceName.c_str());
data.WriteCString(info.bssid.c_str());
data.WriteCString(info.ipAddr.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_ADD_BLOCK_LIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ADD_BLOCK_LIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_ADD_BLOCK_LIST);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ADD_BLOCK_LIST));
return WIFI_OPT_FAILED;
}
@ -503,9 +529,11 @@ ErrCode WifiHotspotProxy::DelBlockList(const StationInfo &info)
data.WriteCString(info.deviceName.c_str());
data.WriteCString(info.bssid.c_str());
data.WriteCString(info.ipAddr.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_DEL_BLOCK_LIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DEL_BLOCK_LIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_DEL_BLOCK_LIST);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DEL_BLOCK_LIST));
return WIFI_OPT_FAILED;
}
@ -530,9 +558,11 @@ ErrCode WifiHotspotProxy::GetValidBands(std::vector<BandType> &bands)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_VALID_BANDS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_BANDS), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_VALID_BANDS);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_BANDS));
return WIFI_OPT_FAILED;
}
@ -573,9 +603,11 @@ ErrCode WifiHotspotProxy::GetValidChannels(BandType band, std::vector<int32_t> &
}
data.WriteInt32(0);
data.WriteInt32((int)band);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_VALID_CHANNELS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_CHANNELS),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_VALID_CHANNELS);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_CHANNELS));
return WIFI_OPT_FAILED;
}
@ -626,7 +658,8 @@ ErrCode WifiHotspotProxy::RegisterCallBack(const sptr<IWifiHotspotCallback> &cal
data.WriteString(eventName);
}
}
int error = Remote()->SendRequest(WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK, data, reply, option);
int error = Remote()->SendRequest(
static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK), data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("WifiHotspotProxy::RegisterCallBack failed, error code is %{public}d ", error);
return WIFI_OPT_FAILED;
@ -652,9 +685,11 @@ ErrCode WifiHotspotProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -684,9 +719,11 @@ ErrCode WifiHotspotProxy::GetSupportedPowerModel(std::set<PowerModel>& setPowerM
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL, data, reply, option);
int error = Remote()->SendRequest(
static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL), data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL));
return WIFI_OPT_FAILED;
}
@ -726,9 +763,11 @@ ErrCode WifiHotspotProxy::GetPowerModel(PowerModel& model)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_POWER_MODEL, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_POWER_MODEL), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_POWER_MODEL);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_POWER_MODEL));
return WIFI_OPT_FAILED;
}
@ -759,9 +798,11 @@ ErrCode WifiHotspotProxy::SetPowerModel(const PowerModel& model)
}
data.WriteInt32(0);
data.WriteInt32(static_cast<int>(model));
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_POWER_MODEL, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SET_POWER_MODEL), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SET_POWER_MODEL);
WIFI_LOGE("Set Attr(%{public}d) failed",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SET_POWER_MODEL));
return WIFI_OPT_FAILED;
}

View File

@ -15,6 +15,7 @@
#include "wifi_p2p_callback_stub.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_errcode.h"
#include "wifi_hisysevent.h"
#include "wifi_logger.h"
@ -33,15 +34,24 @@ WifiP2pCallbackStub::~WifiP2pCallbackStub()
void WifiP2pCallbackStub::InitHandleMap()
{
handleFuncMap[WIFI_CBK_CMD_P2P_STATE_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pStateChanged;
handleFuncMap[WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pPersistentGroupsChanged;
handleFuncMap[WIFI_CBK_CMD_THIS_DEVICE_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pThisDeviceChanged;
handleFuncMap[WIFI_CBK_CMD_PEER_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pPeersChanged;
handleFuncMap[WIFI_CBK_CMD_SERVICE_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pServicesChanged;
handleFuncMap[WIFI_CBK_CMD_CONNECT_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pConnectionChanged;
handleFuncMap[WIFI_CBK_CMD_DISCOVERY_CHANGE] = &WifiP2pCallbackStub::RemoteOnP2pDiscoveryChanged;
handleFuncMap[WIFI_CBK_CMD_P2P_ACTION_RESULT] = &WifiP2pCallbackStub::RemoteOnP2pActionResult;
handleFuncMap[WIFI_CBK_CMD_CFG_CHANGE] = &WifiP2pCallbackStub::RemoteOnConfigChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_STATE_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pStateChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pPersistentGroupsChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_THIS_DEVICE_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pThisDeviceChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PEER_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pPeersChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_SERVICE_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pServicesChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CONNECT_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pConnectionChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_DISCOVERY_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnP2pDiscoveryChanged;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_ACTION_RESULT)] =
&WifiP2pCallbackStub::RemoteOnP2pActionResult;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE)] =
&WifiP2pCallbackStub::RemoteOnConfigChanged;
return;
}

View File

@ -14,6 +14,7 @@
*/
#include "wifi_p2p_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_logger.h"
#include "wifi_p2p_callback_stub.h"
@ -82,9 +83,11 @@ ErrCode WifiP2pProxy::EnableP2p(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_ENABLE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_ENABLE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_ENABLE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_ENABLE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -108,9 +111,11 @@ ErrCode WifiP2pProxy::DisableP2p(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_DISABLE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISABLE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_DISABLE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISABLE), error);
return WIFI_OPT_FAILED;
}
@ -135,9 +140,11 @@ ErrCode WifiP2pProxy::DiscoverDevices(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_DISCOVER_DEVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_DEVICES), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_DISCOVER_DEVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_DEVICES), error);
return WIFI_OPT_FAILED;
}
@ -162,10 +169,11 @@ ErrCode WifiP2pProxy::StopDiscoverDevices(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE(
"Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES), error);
return WIFI_OPT_FAILED;
}
@ -190,9 +198,11 @@ ErrCode WifiP2pProxy::DiscoverServices(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_DISCOVER_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_SERVICES), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_DISCOVER_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -217,10 +227,11 @@ ErrCode WifiP2pProxy::StopDiscoverServices(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE(
"Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -246,9 +257,11 @@ ErrCode WifiP2pProxy::RequestService(const WifiP2pDevice &device, const WifiP2pS
}
data.WriteInt32(0);
WriteWifiP2pServiceRequest(data, device, request);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_REQUEST_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REQUEST_SERVICES), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_REQUEST_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REQUEST_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -274,9 +287,11 @@ ErrCode WifiP2pProxy::PutLocalP2pService(const WifiP2pServiceInfo &srvInfo)
}
data.WriteInt32(0);
WriteWifiP2pServiceInfo(data, srvInfo);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -302,10 +317,11 @@ ErrCode WifiP2pProxy::DeleteLocalP2pService(const WifiP2pServiceInfo &srvInfo)
}
data.WriteInt32(0);
WriteWifiP2pServiceInfo(data, srvInfo);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE(
"Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -332,9 +348,11 @@ ErrCode WifiP2pProxy::StartP2pListen(int period, int interval)
data.WriteInt32(0);
data.WriteInt32(period);
data.WriteInt32(interval);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_START_LISTEN, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_START_LISTEN), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_START_LISTEN, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_START_LISTEN), error);
return WIFI_OPT_FAILED;
}
@ -359,9 +377,11 @@ ErrCode WifiP2pProxy::StopP2pListen(void)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_STOP_LISTEN, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_LISTEN), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_STOP_LISTEN, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_LISTEN), error);
return WIFI_OPT_FAILED;
}
@ -387,9 +407,11 @@ ErrCode WifiP2pProxy::CreateGroup(const WifiP2pConfig &config)
}
data.WriteInt32(0);
WriteWifiP2pConfigData(data, config);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_CREATE_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CREATE_GROUP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_CREATE_GROUP, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CREATE_GROUP), error);
return WIFI_OPT_FAILED;
}
@ -414,9 +436,11 @@ ErrCode WifiP2pProxy::RemoveGroup()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_REMOVE_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REMOVE_GROUP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_REMOVE_GROUP, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REMOVE_GROUP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -441,9 +465,11 @@ ErrCode WifiP2pProxy::DeleteGroup(const WifiP2pGroupInfo &group)
}
data.WriteInt32(0);
WriteWifiP2pGroupData(data, group);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_DELETE_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_GROUP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_DELETE_GROUP, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_GROUP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -612,9 +638,11 @@ ErrCode WifiP2pProxy::P2pConnect(const WifiP2pConfig &config)
}
data.WriteInt32(0);
WriteWifiP2pConfigData(data, config);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_CONNECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CONNECT), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_CONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CONNECT), error);
return WIFI_OPT_FAILED;
}
@ -639,9 +667,11 @@ ErrCode WifiP2pProxy::P2pCancelConnect()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_CANCEL_CONNECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CANCEL_CONNECT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_CANCEL_CONNECT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CANCEL_CONNECT), error);
return WIFI_OPT_FAILED;
}
@ -666,9 +696,11 @@ ErrCode WifiP2pProxy::QueryP2pLinkedInfo(WifiP2pLinkedInfo &linkedInfo)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_QUERY_INFO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_INFO), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_QUERY_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_INFO), error);
return WIFI_OPT_FAILED;
}
@ -702,9 +734,11 @@ ErrCode WifiP2pProxy::GetCurrentGroup(WifiP2pGroupInfo &group)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP), error);
return WIFI_OPT_FAILED;
}
@ -734,9 +768,11 @@ ErrCode WifiP2pProxy::GetP2pEnableStatus(int &status)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS), error);
return WIFI_OPT_FAILED;
}
@ -766,9 +802,11 @@ ErrCode WifiP2pProxy::GetP2pDiscoverStatus(int &status)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS), error);
return WIFI_OPT_FAILED;
}
@ -798,9 +836,11 @@ ErrCode WifiP2pProxy::GetP2pConnectedStatus(int &status)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS), error);
return WIFI_OPT_FAILED;
}
@ -830,9 +870,11 @@ ErrCode WifiP2pProxy::QueryP2pDevices(std::vector<WifiP2pDevice> &devices)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_QUERY_DEVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_DEVICES), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_QUERY_DEVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_DEVICES), error);
return WIFI_OPT_FAILED;
}
@ -873,9 +915,11 @@ ErrCode WifiP2pProxy::QueryP2pLocalDevice(WifiP2pDevice &device)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE), error);
return WIFI_OPT_FAILED;
}
@ -905,9 +949,11 @@ ErrCode WifiP2pProxy::QueryP2pGroups(std::vector<WifiP2pGroupInfo> &groups)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_QUERY_GROUPS, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_GROUPS), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_QUERY_GROUPS, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_GROUPS), error);
return WIFI_OPT_FAILED;
}
@ -948,9 +994,11 @@ ErrCode WifiP2pProxy::QueryP2pServices(std::vector<WifiP2pServiceInfo> &services
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_QUERY_SERVICES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_SERVICES), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_QUERY_SERVICES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_SERVICES), error);
return WIFI_OPT_FAILED;
}
@ -992,9 +1040,11 @@ ErrCode WifiP2pProxy::SetP2pDeviceName(const std::string &deviceName)
}
data.WriteInt32(0);
data.WriteString(deviceName);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_SET_DEVICE_NAME, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_DEVICE_NAME), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_SET_DEVICE_NAME, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_DEVICE_NAME), error);
return WIFI_OPT_FAILED;
}
@ -1026,9 +1076,11 @@ ErrCode WifiP2pProxy::SetP2pWfdInfo(const WifiP2pWfdInfo &wfdInfo)
data.WriteInt32(wfdInfo.GetDeviceInfo());
data.WriteInt32(wfdInfo.GetCtrlPort());
data.WriteInt32(wfdInfo.GetMaxThroughput());
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_SET_WFD_INFO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_WFD_INFO), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_SET_WFD_INFO, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_WFD_INFO), error);
return WIFI_OPT_FAILED;
}
@ -1075,7 +1127,8 @@ ErrCode WifiP2pProxy::RegisterCallBack(const sptr<IWifiP2pCallback> &callback, c
data.WriteString(eventName);
}
}
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_REGISTER_CALLBACK, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REGISTER_CALLBACK), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("RegisterCallBack failed, error code is %{public}d", error);
return WIFI_OPT_FAILED;
@ -1102,9 +1155,11 @@ ErrCode WifiP2pProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -1135,9 +1190,11 @@ ErrCode WifiP2pProxy::Hid2dRequestGcIp(const std::string& gcMac, std::string& ip
}
data.WriteInt32(0);
data.WriteCString(gcMac.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_APPLY_IP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_APPLY_IP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_P2P_HID2D_APPLY_IP, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_APPLY_IP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1167,10 +1224,11 @@ ErrCode WifiP2pProxy::Hid2dSharedlinkIncrease()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE, data, reply, option);
int error = Remote()->SendRequest(
static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE), data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1194,10 +1252,11 @@ ErrCode WifiP2pProxy::Hid2dSharedlinkDecrease()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE, data, reply, option);
int error = Remote()->SendRequest(
static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE), data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1225,10 +1284,11 @@ ErrCode WifiP2pProxy::Hid2dCreateGroup(const int frequency, FreqType type)
data.WriteInt32(0);
data.WriteInt32(frequency);
data.WriteInt32(static_cast<int>(type));
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1255,10 +1315,11 @@ ErrCode WifiP2pProxy::Hid2dRemoveGcGroup(const std::string& gcIfName)
}
data.WriteInt32(0);
data.WriteCString(gcIfName.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1289,10 +1350,11 @@ ErrCode WifiP2pProxy::Hid2dConnect(const Hid2dConnectConfig& config)
data.WriteCString(config.GetPreSharedKey().c_str());
data.WriteInt32(config.GetFrequency());
data.WriteInt32(static_cast<int>(config.GetDhcpMode()));
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_CONNECT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONNECT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_CONNECT, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONNECT), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1320,10 +1382,11 @@ ErrCode WifiP2pProxy::Hid2dConfigIPAddr(const std::string& ifName, const IpAddrI
data.WriteCString(ipInfo.ip.c_str());
data.WriteCString(ipInfo.gateway.c_str());
data.WriteCString(ipInfo.netmask.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1348,10 +1411,11 @@ ErrCode WifiP2pProxy::Hid2dReleaseIPAddr(const std::string& ifName)
}
data.WriteInt32(0);
data.WriteCString(ifName.c_str());
int error = Remote()->SendRequest(WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP), error);
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1381,10 +1445,11 @@ ErrCode WifiP2pProxy::Hid2dGetRecommendChannel(const RecommendChannelRequest& re
data.WriteInt32(request.localIfMode);
data.WriteInt32(request.prefBand);
data.WriteInt32(static_cast<int>(request.prefBandwidth));
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL, error);
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();
@ -1418,9 +1483,11 @@ ErrCode WifiP2pProxy::Hid2dGetChannelListFor5G(std::vector<int>& vecChannelList)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_5G_CHANNEL_LIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNEL_LIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_5G_CHANNEL_LIST);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNEL_LIST));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1465,9 +1532,11 @@ ErrCode WifiP2pProxy::Hid2dGetSelfWifiCfgInfo(SelfCfgType cfgType,
}
data.WriteInt32(0);
data.WriteInt32(static_cast<int>(cfgType));
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SELF_WIFI_CFG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_SELF_WIFI_CFG), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_SELF_WIFI_CFG);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_SELF_WIFI_CFG));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1516,9 +1585,11 @@ ErrCode WifiP2pProxy::Hid2dSetPeerWifiCfgInfo(PeerCfgType cfgType,
data.WriteInt32(static_cast<int>(cfgType));
data.WriteInt32(setDataValidLen);
data.WriteBuffer(cfgData, setDataValidLen);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_PEER_WIFI_CFG, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_PEER_WIFI_CFG), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SET_PEER_WIFI_CFG);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_PEER_WIFI_CFG));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -1547,9 +1618,10 @@ ErrCode WifiP2pProxy::Hid2dSetUpperScene(const std::string& ifName, const Hid2dU
data.WriteUint32(scene.scene);
data.WriteInt32(scene.fps);
data.WriteUint32(scene.bw);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_UPPER_SCENE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_UPPER_SCENE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SET_UPPER_SCENE);
WIFI_LOGW("Set Attr(%{public}d) failed", static_cast<int32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_UPPER_SCENE));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();

View File

@ -15,6 +15,7 @@
#include "wifi_scan_callback_stub.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_hisysevent.h"
#include "wifi_logger.h"
#include "wifi_msg.h"
@ -45,7 +46,7 @@ int WifiScanCallbackStub::OnRemoteRequest(
}
int ret = -1;
switch (code) {
case WIFI_CBK_CMD_SCAN_STATE_CHANGE: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_CBK_CMD_SCAN_STATE_CHANGE): {
WIFI_LOGD("WifiScanCallbackStub::OnRemoteRequest code:%{public}u line:%{public}d!", code, __LINE__);
ret = RemoteOnWifiScanStateChanged(code, data, reply);
break;

View File

@ -15,6 +15,7 @@
#include "wifi_scan_callback_stub.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_errcode.h"
#include "wifi_logger.h"
#include "wifi_msg.h"
@ -55,7 +56,7 @@ int WifiScanCallbackStub::OnRemoteRequest(uint32_t code, IpcIo *data)
return ret;
}
switch (code) {
case WIFI_CBK_CMD_SCAN_STATE_CHANGE: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_CBK_CMD_SCAN_STATE_CHANGE): {
WIFI_LOGD("OnRemoteRequest code:%{public}u", code);
ret = RemoteOnWifiScanStateChanged(code, data);
break;

View File

@ -19,6 +19,7 @@
#include <new>
#include <string>
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_types.h"
#include "iremote_proxy.h"
#include "message_option.h"
@ -110,9 +111,11 @@ ErrCode WifiScanProxy::SetScanControlInfo(const ScanControlInfo &info)
data.WriteInt32(iter2->count);
}
int error = Remote()->SendRequest(WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -141,9 +144,10 @@ ErrCode WifiScanProxy::Scan()
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_FULL_SCAN, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_FULL_SCAN);
WIFI_LOGW("Set Attr(%{public}d) failed", static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -181,9 +185,11 @@ ErrCode WifiScanProxy::AdvanceScan(const WifiScanParams &params)
}
data.WriteInt32(params.band);
int error = Remote()->SendRequest(WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -213,9 +219,11 @@ ErrCode WifiScanProxy::IsWifiClosedScan(bool &bOpen)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -244,9 +252,11 @@ ErrCode WifiScanProxy::GetScanInfoList(std::vector<WifiScanInfo> &result)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SCAN_INFO_LIST, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_SCAN_INFO_LIST);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST));
return WIFI_OPT_FAILED;
}
int exception = reply.ReadInt32();
@ -336,7 +346,8 @@ ErrCode WifiScanProxy::RegisterCallBack(const sptr<IWifiScanCallback> &callback,
}
}
WIFI_LOGD("%{public}s, calling uid: %{public}d, pid: %{public}d", __func__, GetCallingUid(), pid);
int error = Remote()->SendRequest(WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("RegisterCallBack failed, error code is %{public}d", error);
return WIFI_OPT_FAILED;
@ -359,9 +370,11 @@ ErrCode WifiScanProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return ErrCode(error);
}
int exception = reply.ReadInt32();

View File

@ -15,6 +15,7 @@
#include "wifi_scan_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "serializer.h"
@ -105,17 +106,17 @@ static int IpcCallback(void *owner, int code, IpcIo *reply)
}
switch (data->funcId) {
case WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE): {
(void)ReadBool(reply, (bool *)data->variable);
break;
}
case WIFI_SVR_CMD_GET_SUPPORTED_FEATURES: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES): {
int64_t features = 0;
(void)ReadInt64(reply, &features);
*((long *)data->variable) = features;
break;
}
case WIFI_SVR_CMD_GET_SCAN_INFO_LIST: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST): {
data->retCode = ParseScanInfos(reply, *((std::vector<WifiScanInfo> *)data->variable));
break;
}
@ -231,10 +232,12 @@ ErrCode WifiScanProxy::SetScanControlInfo(const ScanControlInfo &info)
(void)WriteInt32(&request, iter2->count);
}
owner.funcId = WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO));
return WIFI_OPT_FAILED;
}
@ -263,10 +266,11 @@ ErrCode WifiScanProxy::Scan()
}
(void)WriteInt32(&request, 0);
owner.funcId = WIFI_SVR_CMD_FULL_SCAN;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_FULL_SCAN, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_FULL_SCAN);
WIFI_LOGW("Set Attr(%{public}d) failed", static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN));
return WIFI_OPT_FAILED;
}
@ -302,10 +306,12 @@ ErrCode WifiScanProxy::AdvanceScan(const WifiScanParams &params)
}
(void)WriteUint32(&request, params.band);
owner.funcId = WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN));
return WIFI_OPT_FAILED;
}
@ -335,10 +341,12 @@ ErrCode WifiScanProxy::IsWifiClosedScan(bool &bOpen)
}
(void)WriteInt32(&request, 0);
owner.variable = &bOpen;
owner.funcId = WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE));
return WIFI_OPT_FAILED;
}
@ -367,10 +375,12 @@ ErrCode WifiScanProxy::GetScanInfoList(std::vector<WifiScanInfo> &result)
}
(void)WriteInt32(&request, 0);
owner.variable = &result;
owner.funcId = WIFI_SVR_CMD_GET_SCAN_INFO_LIST;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_SCAN_INFO_LIST, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGW("Set Attr(%{public}d) failed", WIFI_SVR_CMD_GET_SCAN_INFO_LIST);
WIFI_LOGW("Set Attr(%{public}d) failed",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST));
return WIFI_OPT_FAILED;
}
@ -415,8 +425,9 @@ ErrCode WifiScanProxy::RegisterCallBack(const std::shared_ptr<IWifiScanCallback>
(void)WriteString(&request, eventName.c_str());
}
}
owner.funcId = WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK);
int error = remote_->Invoke(remote_, static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("RegisterCallBack failed, error code is %{public}d", error);
return WIFI_OPT_FAILED;
@ -448,10 +459,12 @@ ErrCode WifiScanProxy::GetSupportedFeatures(long &features)
}
(void)WriteInt32(&request, 0);
owner.variable = &features;
owner.funcId = WIFI_SVR_CMD_GET_SUPPORTED_FEATURES;
int error = remote_->Invoke(remote_, WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, &request, &owner, IpcCallback);
owner.funcId = static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES);
int error = remote_->Invoke(remote_, static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
&request, &owner, IpcCallback);
if (error != EC_SUCCESS) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), error);
return ErrCode(error);
}

View File

@ -16,6 +16,7 @@
#include "wifi_device_callback_proxy.h"
#include "wifi_logger.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_LABEL("WifiDeviceCallBackProxy");
@ -37,9 +38,11 @@ void WifiDeviceCallBackProxy::OnWifiStateChanged(int state)
}
data.WriteInt32(0);
data.WriteInt32(state);
int error = Remote()->SendRequest(WIFI_CBK_CMD_STATE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_STATE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -81,9 +84,11 @@ void WifiDeviceCallBackProxy::OnWifiConnectionChanged(int state, const WifiLinke
data.WriteString(info.portalUrl);
data.WriteInt32((int)info.supplicantState);
data.WriteInt32((int)info.detailedState);
int error = Remote()->SendRequest(WIFI_CBK_CMD_CONNECTION_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_CONNECTION_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -105,9 +110,11 @@ void WifiDeviceCallBackProxy::OnWifiRssiChanged(int rssi)
}
data.WriteInt32(0);
data.WriteInt32(rssi);
int error = Remote()->SendRequest(WIFI_CBK_CMD_RSSI_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_RSSI_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -130,9 +137,11 @@ void WifiDeviceCallBackProxy::OnWifiWpsStateChanged(int state, const std::string
data.WriteInt32(0);
data.WriteInt32(state);
data.WriteCString(pinCode.c_str());
int error = Remote()->SendRequest(WIFI_CBK_CMD_WPS_STATE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_WPS_STATE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -154,9 +163,11 @@ void WifiDeviceCallBackProxy::OnStreamChanged(int direction)
}
data.WriteInt32(0);
data.WriteInt32(direction);
int error = Remote()->SendRequest(WIFI_CBK_CMD_STREAM_DIRECTION, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_STREAM_DIRECTION, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION), error);
return;
}
int exception = reply.ReadInt32();
@ -178,9 +189,11 @@ void WifiDeviceCallBackProxy::OnDeviceConfigChanged(ConfigChange value)
}
data.WriteInt32(0);
data.WriteInt32((int)value);
int error = Remote()->SendRequest(WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE), error);
return;
}
int exception = reply.ReadInt32();

View File

@ -15,6 +15,7 @@
#include "wifi_device_callback_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "wifi_logger.h"
@ -49,9 +50,11 @@ void WifiDeviceCallBackProxy::OnWifiStateChanged(int state)
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_STATE_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE), &data, &reply,
option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_STATE_CHANGE, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE), ret);
}
}
@ -92,9 +95,11 @@ void WifiDeviceCallBackProxy::OnWifiConnectionChanged(int state, const WifiLinke
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_CONNECTION_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE), &data, &reply,
option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_CONNECTION_CHANGE, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE), ret);
}
}
@ -115,9 +120,11 @@ void WifiDeviceCallBackProxy::OnWifiRssiChanged(int rssi)
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_RSSI_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE), &data, &reply,
option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_RSSI_CHANGE, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE), ret);
}
}
@ -139,9 +146,11 @@ void WifiDeviceCallBackProxy::OnWifiWpsStateChanged(int state, const std::string
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_WPS_STATE_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE), &data, &reply,
option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_WPS_STATE_CHANGE, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE), ret);
}
}
@ -162,9 +171,11 @@ void WifiDeviceCallBackProxy::OnStreamChanged(int direction)
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_STREAM_DIRECTION, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION), &data, &reply,
option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_STREAM_DIRECTION, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION), ret);
}
}
@ -185,9 +196,11 @@ void WifiDeviceCallBackProxy::OnDeviceConfigChanged(ConfigChange state)
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE), &data,
&reply, option, nullptr);
if (ret != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE, ret);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE), ret);
}
}
} // namespace Wifi

View File

@ -22,6 +22,7 @@
#include "wifi_device_death_recipient.h"
#include "wifi_common_util.h"
#include "wifi_common_def.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_LABEL("WifiDeviceStub");
@ -35,43 +36,74 @@ WifiDeviceStub::WifiDeviceStub() : mSingleCallback(false)
WifiDeviceStub::~WifiDeviceStub()
{}
void WifiDeviceStub::InitHandleMapEx()
{
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD)] =
&WifiDeviceStub::OnGetDeviceMacAdd;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED)] =
&WifiDeviceStub::OnIsWifiConnected;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE)] =
&WifiDeviceStub::OnSetLowLatencyMode;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG)] =
&WifiDeviceStub::OnRemoveCandidateConfig;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED)] =
&WifiDeviceStub::OnIsBandTypeSupported;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST)] =
&WifiDeviceStub::OnGet5GHzChannelList;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DISCONNECTED_REASON)] =
&WifiDeviceStub::OnGetDisconnectedReason;
return;
}
void WifiDeviceStub::InitHandleMap()
{
handleFuncMap[WIFI_SVR_CMD_ENABLE_WIFI] = &WifiDeviceStub::OnEnableWifi;
handleFuncMap[WIFI_SVR_CMD_DISABLE_WIFI] = &WifiDeviceStub::OnDisableWifi;
handleFuncMap[WIFI_SVR_CMD_INIT_WIFI_PROTECT] = &WifiDeviceStub::OnInitWifiProtect;
handleFuncMap[WIFI_SVR_CMD_GET_WIFI_PROTECT] = &WifiDeviceStub::OnGetWifiProtectRef;
handleFuncMap[WIFI_SVR_CMD_PUT_WIFI_PROTECT] = &WifiDeviceStub::OnPutWifiProtectRef;
handleFuncMap[WIFI_SVR_CMD_ADD_DEVICE_CONFIG] = &WifiDeviceStub::OnAddDeviceConfig;
handleFuncMap[WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG] = &WifiDeviceStub::OnUpdateDeviceConfig;
handleFuncMap[WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG] = &WifiDeviceStub::OnRemoveDevice;
handleFuncMap[WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG] = &WifiDeviceStub::OnRemoveAllDevice;
handleFuncMap[WIFI_SVR_CMD_GET_DEVICE_CONFIGS] = &WifiDeviceStub::OnGetDeviceConfigs;
handleFuncMap[WIFI_SVR_CMD_ENABLE_DEVICE] = &WifiDeviceStub::OnEnableDeviceConfig;
handleFuncMap[WIFI_SVR_CMD_DISABLE_DEVICE] = &WifiDeviceStub::OnDisableDeviceConfig;
handleFuncMap[WIFI_SVR_CMD_CONNECT_TO] = &WifiDeviceStub::OnConnectTo;
handleFuncMap[WIFI_SVR_CMD_CONNECT2_TO] = &WifiDeviceStub::OnConnect2To;
handleFuncMap[WIFI_SVR_CMD_RECONNECT] = &WifiDeviceStub::OnReConnect;
handleFuncMap[WIFI_SVR_CMD_REASSOCIATE] = &WifiDeviceStub::OnReAssociate;
handleFuncMap[WIFI_SVR_CMD_DISCONNECT] = &WifiDeviceStub::OnDisconnect;
handleFuncMap[WIFI_SVR_CMD_START_WPS] = &WifiDeviceStub::OnStartWps;
handleFuncMap[WIFI_SVR_CMD_CANCEL_WPS] = &WifiDeviceStub::OnCancelWps;
handleFuncMap[WIFI_SVR_CMD_IS_WIFI_ACTIVE] = &WifiDeviceStub::OnIsWifiActive;
handleFuncMap[WIFI_SVR_CMD_GET_WIFI_STATE] = &WifiDeviceStub::OnGetWifiState;
handleFuncMap[WIFI_SVR_CMD_GET_LINKED_INFO] = &WifiDeviceStub::OnGetLinkedInfo;
handleFuncMap[WIFI_SVR_CMD_GET_DHCP_INFO] = &WifiDeviceStub::OnGetIpInfo;
handleFuncMap[WIFI_SVR_CMD_SET_COUNTRY_CODE] = &WifiDeviceStub::OnSetCountryCode;
handleFuncMap[WIFI_SVR_CMD_GET_COUNTRY_CODE] = &WifiDeviceStub::OnGetCountryCode;
handleFuncMap[WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT] = &WifiDeviceStub::OnRegisterCallBack;
handleFuncMap[WIFI_SVR_CMD_GET_SIGNAL_LEVEL] = &WifiDeviceStub::OnGetSignalLevel;
handleFuncMap[WIFI_SVR_CMD_GET_SUPPORTED_FEATURES] = &WifiDeviceStub::OnGetSupportedFeatures;
handleFuncMap[WIFI_SVR_CMD_GET_DERVICE_MAC_ADD] = &WifiDeviceStub::OnGetDeviceMacAdd;
handleFuncMap[WIFI_SVR_CMD_IS_WIFI_CONNECTED] = &WifiDeviceStub::OnIsWifiConnected;
handleFuncMap[WIFI_SVR_CMD_SET_LOW_LATENCY_MODE] = &WifiDeviceStub::OnSetLowLatencyMode;
handleFuncMap[WIFI_SVR_CMD_REMOVE_CANDIDATE_CONFIG] = &WifiDeviceStub::OnRemoveCandidateConfig;
handleFuncMap[WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED] = &WifiDeviceStub::OnIsBandTypeSupported;
handleFuncMap[WIFI_SVR_CMD_GET_5G_CHANNELLIST] = &WifiDeviceStub::OnGet5GHzChannelList;
handleFuncMap[WIFI_SVR_CMD_GET_DISCONNECTED_REASON] = &WifiDeviceStub::OnGetDisconnectedReason;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI)] = &WifiDeviceStub::OnEnableWifi;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI)] = &WifiDeviceStub::OnDisableWifi;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT)] =
&WifiDeviceStub::OnInitWifiProtect;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT)] =
&WifiDeviceStub::OnGetWifiProtectRef;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT)] =
&WifiDeviceStub::OnPutWifiProtectRef;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG)] =
&WifiDeviceStub::OnAddDeviceConfig;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG)] =
&WifiDeviceStub::OnUpdateDeviceConfig;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG)] =
&WifiDeviceStub::OnRemoveDevice;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG)] =
&WifiDeviceStub::OnRemoveAllDevice;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS)] =
&WifiDeviceStub::OnGetDeviceConfigs;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE)] =
&WifiDeviceStub::OnEnableDeviceConfig;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE)] =
&WifiDeviceStub::OnDisableDeviceConfig;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO)] = &WifiDeviceStub::OnConnectTo;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO)] = &WifiDeviceStub::OnConnect2To;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT)] = &WifiDeviceStub::OnReConnect;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE)] = &WifiDeviceStub::OnReAssociate;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT)] = &WifiDeviceStub::OnDisconnect;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS)] = &WifiDeviceStub::OnStartWps;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS)] = &WifiDeviceStub::OnCancelWps;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE)] =
&WifiDeviceStub::OnIsWifiActive;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE)] =
&WifiDeviceStub::OnGetWifiState;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO)] =
&WifiDeviceStub::OnGetLinkedInfo;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO)] = &WifiDeviceStub::OnGetIpInfo;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE)] =
&WifiDeviceStub::OnSetCountryCode;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE)] =
&WifiDeviceStub::OnGetCountryCode;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT)] =
&WifiDeviceStub::OnRegisterCallBack;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL)] =
&WifiDeviceStub::OnGetSignalLevel;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES)] =
&WifiDeviceStub::OnGetSupportedFeatures;
InitHandleMapEx();
return;
}

View File

@ -36,6 +36,7 @@ public:
private:
void InitHandleMap();
void InitHandleMapEx(void);
void OnEnableWifi(uint32_t code, MessageParcel &data, MessageParcel &reply);
void OnDisableWifi(uint32_t code, MessageParcel &data, MessageParcel &reply);
void OnInitWifiProtect(uint32_t code, MessageParcel &data, MessageParcel &reply);

View File

@ -15,6 +15,7 @@
#include "wifi_device_stub_lite.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "wifi_device_callback_proxy.h"
@ -586,41 +587,70 @@ void WifiDeviceStub::OnGet5GHzChannelList(uint32_t code, IpcIo *req, IpcIo *repl
}
}
void WifiDeviceStub::InitHandleMapEx()
{
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DERVICE_MAC_ADD)] =
&WifiDeviceStub::OnGetDeviceMacAdd;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_CONNECTED)] =
&WifiDeviceStub::OnIsWifiConnected;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_LOW_LATENCY_MODE)] =
&WifiDeviceStub::OnSetLowLatencyMode;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED)] =
&WifiDeviceStub::OnIsBandTypeSupported;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNELLIST)] =
&WifiDeviceStub::OnGet5GHzChannelList;
return;
}
void WifiDeviceStub::InitHandleMap()
{
handleFuncMap_[WIFI_SVR_CMD_ENABLE_WIFI] = &WifiDeviceStub::OnEnableWifi;
handleFuncMap_[WIFI_SVR_CMD_DISABLE_WIFI] = &WifiDeviceStub::OnDisableWifi;
handleFuncMap_[WIFI_SVR_CMD_INIT_WIFI_PROTECT] = &WifiDeviceStub::OnInitWifiProtect;
handleFuncMap_[WIFI_SVR_CMD_GET_WIFI_PROTECT] = &WifiDeviceStub::OnGetWifiProtectRef;
handleFuncMap_[WIFI_SVR_CMD_PUT_WIFI_PROTECT] = &WifiDeviceStub::OnPutWifiProtectRef;
handleFuncMap_[WIFI_SVR_CMD_ADD_DEVICE_CONFIG] = &WifiDeviceStub::OnAddDeviceConfig;
handleFuncMap_[WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG] = &WifiDeviceStub::OnUpdateDeviceConfig;
handleFuncMap_[WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG] = &WifiDeviceStub::OnRemoveDevice;
handleFuncMap_[WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG] = &WifiDeviceStub::OnRemoveAllDevice;
handleFuncMap_[WIFI_SVR_CMD_GET_DEVICE_CONFIGS] = &WifiDeviceStub::OnGetDeviceConfigs;
handleFuncMap_[WIFI_SVR_CMD_ENABLE_DEVICE] = &WifiDeviceStub::OnEnableDeviceConfig;
handleFuncMap_[WIFI_SVR_CMD_DISABLE_DEVICE] = &WifiDeviceStub::OnDisableDeviceConfig;
handleFuncMap_[WIFI_SVR_CMD_CONNECT_TO] = &WifiDeviceStub::OnConnectTo;
handleFuncMap_[WIFI_SVR_CMD_CONNECT2_TO] = &WifiDeviceStub::OnConnect2To;
handleFuncMap_[WIFI_SVR_CMD_RECONNECT] = &WifiDeviceStub::OnReConnect;
handleFuncMap_[WIFI_SVR_CMD_REASSOCIATE] = &WifiDeviceStub::OnReAssociate;
handleFuncMap_[WIFI_SVR_CMD_DISCONNECT] = &WifiDeviceStub::OnDisconnect;
handleFuncMap_[WIFI_SVR_CMD_START_WPS] = &WifiDeviceStub::OnStartWps;
handleFuncMap_[WIFI_SVR_CMD_CANCEL_WPS] = &WifiDeviceStub::OnCancelWps;
handleFuncMap_[WIFI_SVR_CMD_IS_WIFI_ACTIVE] = &WifiDeviceStub::OnIsWifiActive;
handleFuncMap_[WIFI_SVR_CMD_GET_WIFI_STATE] = &WifiDeviceStub::OnGetWifiState;
handleFuncMap_[WIFI_SVR_CMD_GET_LINKED_INFO] = &WifiDeviceStub::OnGetLinkedInfo;
handleFuncMap_[WIFI_SVR_CMD_GET_DHCP_INFO] = &WifiDeviceStub::OnGetIpInfo;
handleFuncMap_[WIFI_SVR_CMD_SET_COUNTRY_CODE] = &WifiDeviceStub::OnSetCountryCode;
handleFuncMap_[WIFI_SVR_CMD_GET_COUNTRY_CODE] = &WifiDeviceStub::OnGetCountryCode;
handleFuncMap_[WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT] = &WifiDeviceStub::OnRegisterCallBack;
handleFuncMap_[WIFI_SVR_CMD_GET_SIGNAL_LEVEL] = &WifiDeviceStub::OnGetSignalLevel;
handleFuncMap_[WIFI_SVR_CMD_GET_SUPPORTED_FEATURES] = &WifiDeviceStub::OnGetSupportedFeatures;
handleFuncMap_[WIFI_SVR_CMD_GET_DERVICE_MAC_ADD] = &WifiDeviceStub::OnGetDeviceMacAdd;
handleFuncMap_[WIFI_SVR_CMD_IS_WIFI_CONNECTED] = &WifiDeviceStub::OnIsWifiConnected;
handleFuncMap_[WIFI_SVR_CMD_SET_LOW_LATENCY_MODE] = &WifiDeviceStub::OnSetLowLatencyMode;
handleFuncMap_[WIFI_SVR_CMD_GET_BANDTYPE_SUPPORTED] = &WifiDeviceStub::OnIsBandTypeSupported;
handleFuncMap_[WIFI_SVR_CMD_GET_5G_CHANNELLIST] = &WifiDeviceStub::OnGet5GHzChannelList;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI)] = &WifiDeviceStub::OnEnableWifi;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI)] = &WifiDeviceStub::OnDisableWifi;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_INIT_WIFI_PROTECT)] =
&WifiDeviceStub::OnInitWifiProtect;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_PROTECT)] =
&WifiDeviceStub::OnGetWifiProtectRef;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_PUT_WIFI_PROTECT)] =
&WifiDeviceStub::OnPutWifiProtectRef;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ADD_DEVICE_CONFIG)] =
&WifiDeviceStub::OnAddDeviceConfig;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_UPDATE_DEVICE_CONFIG)] =
&WifiDeviceStub::OnUpdateDeviceConfig;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_DEVICE_CONFIG)] =
&WifiDeviceStub::OnRemoveDevice;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REMOVE_ALL_DEVICE_CONFIG)] =
&WifiDeviceStub::OnRemoveAllDevice;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DEVICE_CONFIGS)] =
&WifiDeviceStub::OnGetDeviceConfigs;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_ENABLE_DEVICE)] =
&WifiDeviceStub::OnEnableDeviceConfig;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISABLE_DEVICE)] =
&WifiDeviceStub::OnDisableDeviceConfig;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT_TO)] = &WifiDeviceStub::OnConnectTo;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CONNECT2_TO)] = &WifiDeviceStub::OnConnect2To;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_RECONNECT)] = &WifiDeviceStub::OnReConnect;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REASSOCIATE)] = &WifiDeviceStub::OnReAssociate;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_DISCONNECT)] = &WifiDeviceStub::OnDisconnect;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_START_WPS)] = &WifiDeviceStub::OnStartWps;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_CANCEL_WPS)] = &WifiDeviceStub::OnCancelWps;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_WIFI_ACTIVE)] =
&WifiDeviceStub::OnIsWifiActive;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_WIFI_STATE)] =
&WifiDeviceStub::OnGetWifiState;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_LINKED_INFO)] =
&WifiDeviceStub::OnGetLinkedInfo;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_DHCP_INFO)] = &WifiDeviceStub::OnGetIpInfo;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_SET_COUNTRY_CODE)] =
&WifiDeviceStub::OnSetCountryCode;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_COUNTRY_CODE)] =
&WifiDeviceStub::OnGetCountryCode;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_REGISTER_CALLBACK_CLIENT)] =
&WifiDeviceStub::OnRegisterCallBack;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SIGNAL_LEVEL)] =
&WifiDeviceStub::OnGetSignalLevel;
handleFuncMap_[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES)] =
&WifiDeviceStub::OnGetSupportedFeatures;
InitHandleMapEx();
return;
}
int WifiDeviceStub::OnRemoteRequest(uint32_t code, IpcIo *req, IpcIo *reply)

View File

@ -35,6 +35,7 @@ public:
private:
void InitHandleMap();
void InitHandleMapEx(void);
void OnEnableWifi(uint32_t code, IpcIo *req, IpcIo *reply);
void OnDisableWifi(uint32_t code, IpcIo *req, IpcIo *reply);
void OnInitWifiProtect(uint32_t code, IpcIo *req, IpcIo *reply);

View File

@ -15,6 +15,7 @@
#include "wifi_hotspot_callback_proxy.h"
#include "wifi_logger.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspotCallbackProxy");
@ -36,9 +37,11 @@ void WifiHotspotCallbackProxy::OnHotspotStateChanged(int state)
}
data.WriteInt32(0);
data.WriteInt32(state);
int error = Remote()->SendRequest(WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -63,9 +66,11 @@ void WifiHotspotCallbackProxy::OnHotspotStaJoin(const StationInfo &info)
data.WriteCString(info.deviceName.c_str());
data.WriteCString(info.bssid.c_str());
data.WriteCString(info.ipAddr.c_str());
int error = Remote()->SendRequest(WIFI_CBK_CMD_HOTSPOT_STATE_JOIN, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_JOIN),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_HOTSPOT_STATE_JOIN, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_JOIN), error);
return;
}
int exception = reply.ReadInt32();
@ -89,9 +94,11 @@ void WifiHotspotCallbackProxy::OnHotspotStaLeave(const StationInfo &info)
data.WriteCString(info.deviceName.c_str());
data.WriteCString(info.bssid.c_str());
data.WriteCString(info.ipAddr.c_str());
int error = Remote()->SendRequest(WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE), error);
return;
}
int exception = reply.ReadInt32();

View File

@ -16,12 +16,14 @@
#include "wifi_hotspot_mgr_stub.h"
#include "wifi_logger.h"
#include "wifi_errcode.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspotMgrStub");
namespace OHOS {
namespace Wifi {
WifiHotspotMgrStub::FuncHandleMap WifiHotspotMgrStub::funcHandleMap_ = {
{WIFI_MGR_GET_HOTSPOT_SERVICE, &WifiHotspotMgrStub::GetWifiRemoteInner},
{static_cast<uint32_t>(HotspotInterfaceCode::WIFI_MGR_GET_HOTSPOT_SERVICE),
&WifiHotspotMgrStub::GetWifiRemoteInner},
};
WifiHotspotMgrStub::WifiHotspotMgrStub()

View File

@ -21,6 +21,7 @@
#include "wifi_internal_event_dispatcher.h"
#include "wifi_hotspot_death_recipient.h"
#include "wifi_common_def.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_HOTSPOT_LABEL("WifiHotspotStub");
@ -41,26 +42,46 @@ WifiHotspotStub::~WifiHotspotStub()
void WifiHotspotStub::InitHandleMap()
{
handleFuncMap[WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE] = &WifiHotspotStub::OnIsHotspotActive;
handleFuncMap[WIFI_SVR_CMD_GETAPSTATE_WIFI] = &WifiHotspotStub::OnGetApStateWifi;
handleFuncMap[WIFI_SVR_CMD_GET_HOTSPOT_CONFIG] = &WifiHotspotStub::OnGetHotspotConfig;
handleFuncMap[WIFI_SVR_CMD_SETAPCONFIG_WIFI] = &WifiHotspotStub::OnSetApConfigWifi;
handleFuncMap[WIFI_SVR_CMD_GET_STATION_LIST] = &WifiHotspotStub::OnGetStationList;
handleFuncMap[WIFI_SVR_CMD_ENABLE_WIFI_AP] = &WifiHotspotStub::OnEnableWifiAp;
handleFuncMap[WIFI_SVR_CMD_DISABLE_WIFI_AP] = &WifiHotspotStub::OnDisableWifiAp;
handleFuncMap[WIFI_SVR_CMD_ADD_BLOCK_LIST] = &WifiHotspotStub::OnAddBlockList;
handleFuncMap[WIFI_SVR_CMD_DEL_BLOCK_LIST] = &WifiHotspotStub::OnDelBlockList;
handleFuncMap[WIFI_SVR_CMD_GET_BLOCK_LISTS] = &WifiHotspotStub::OnGetBlockLists;
handleFuncMap[WIFI_SVR_CMD_DISCONNECT_STA] = &WifiHotspotStub::OnDisassociateSta;
handleFuncMap[WIFI_SVR_CMD_GET_VALID_BANDS] = &WifiHotspotStub::OnGetValidBands;
handleFuncMap[WIFI_SVR_CMD_GET_VALID_CHANNELS] = &WifiHotspotStub::OnGetValidChannels;
handleFuncMap[WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK] = &WifiHotspotStub::OnRegisterCallBack;
handleFuncMap[WIFI_SVR_CMD_GET_SUPPORTED_FEATURES] = &WifiHotspotStub::OnGetSupportedFeatures;
handleFuncMap[WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL] = &WifiHotspotStub::OnGetSupportedPowerModel;
handleFuncMap[WIFI_SVR_CMD_GET_POWER_MODEL] = &WifiHotspotStub::OnGetPowerModel;
handleFuncMap[WIFI_SVR_CMD_SET_POWER_MODEL] = &WifiHotspotStub::OnSetPowerModel;
handleFuncMap[WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED] = &WifiHotspotStub::OnIsHotspotDualBandSupported;
handleFuncMap[WIFI_SVR_CMD_SETTIMEOUT_AP] = &WifiHotspotStub::OnSetApIdleTimeout;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_ACTIVE)] =
&WifiHotspotStub::OnIsHotspotActive;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GETAPSTATE_WIFI)] =
&WifiHotspotStub::OnGetApStateWifi;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_HOTSPOT_CONFIG)] =
&WifiHotspotStub::OnGetHotspotConfig;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETAPCONFIG_WIFI)] =
&WifiHotspotStub::OnSetApConfigWifi;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_STATION_LIST)] =
&WifiHotspotStub::OnGetStationList;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI_AP)] =
&WifiHotspotStub::OnEnableWifiAp;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISABLE_WIFI_AP)] =
&WifiHotspotStub::OnDisableWifiAp;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ADD_BLOCK_LIST)] =
&WifiHotspotStub::OnAddBlockList;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DEL_BLOCK_LIST)] =
&WifiHotspotStub::OnDelBlockList;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_BLOCK_LISTS)] =
&WifiHotspotStub::OnGetBlockLists;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_DISCONNECT_STA)] =
&WifiHotspotStub::OnDisassociateSta;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_BANDS)] =
&WifiHotspotStub::OnGetValidBands;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_VALID_CHANNELS)] =
&WifiHotspotStub::OnGetValidChannels;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_REGISTER_HOTSPOT_CALLBACK)] =
&WifiHotspotStub::OnRegisterCallBack;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES)] =
&WifiHotspotStub::OnGetSupportedFeatures;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_POWER_MODEL)] =
&WifiHotspotStub::OnGetSupportedPowerModel;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_GET_POWER_MODEL)] =
&WifiHotspotStub::OnGetPowerModel;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SET_POWER_MODEL)] =
&WifiHotspotStub::OnSetPowerModel;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_IS_HOTSPOT_DUAL_BAND_SUPPORTED)] =
&WifiHotspotStub::OnIsHotspotDualBandSupported;
handleFuncMap[static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_SETTIMEOUT_AP)] =
&WifiHotspotStub::OnSetApIdleTimeout;
return;
}

View File

@ -16,6 +16,7 @@
#include "wifi_p2p_callback_proxy.h"
#include "wifi_logger.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_internal_event_dispatcher.h"
DEFINE_WIFILOG_P2P_LABEL("WifiP2pCallbackProxy");
@ -40,9 +41,11 @@ void WifiP2pCallbackProxy::OnP2pStateChanged(int state)
}
data.WriteInt32(0);
data.WriteInt32(state);
int error = Remote()->SendRequest(WIFI_CBK_CMD_P2P_STATE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_STATE_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_P2P_STATE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_STATE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -63,9 +66,11 @@ void WifiP2pCallbackProxy::OnP2pPersistentGroupsChanged(void)
return;
}
data.WriteInt32(0);
int error = Remote()->SendRequest(WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE),
data, reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -103,9 +108,11 @@ void WifiP2pCallbackProxy::OnP2pThisDeviceChanged(const WifiP2pDevice &device)
}
data.WriteInt32(0);
WriteWifiP2pDeviceData(data, device);
int error = Remote()->SendRequest(WIFI_CBK_CMD_THIS_DEVICE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_THIS_DEVICE_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_THIS_DEVICE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_THIS_DEVICE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -131,9 +138,11 @@ void WifiP2pCallbackProxy::OnP2pPeersChanged(const std::vector<WifiP2pDevice> &d
for (int i = 0; i < size; ++i) {
WriteWifiP2pDeviceData(data, devices[i]);
}
int error = Remote()->SendRequest(WIFI_CBK_CMD_PEER_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PEER_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_PEER_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PEER_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -166,9 +175,11 @@ void WifiP2pCallbackProxy::OnP2pServicesChanged(const std::vector<WifiP2pService
data.WriteCString((*it).c_str());
}
}
int error = Remote()->SendRequest(WIFI_CBK_CMD_SERVICE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_SERVICE_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_SERVICE_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_SERVICE_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -192,9 +203,11 @@ void WifiP2pCallbackProxy::OnP2pConnectionChanged(const WifiP2pLinkedInfo &info)
data.WriteInt32(static_cast<int>(info.GetConnectState()));
data.WriteBool(info.IsGroupOwner());
data.WriteCString(info.GetGroupOwnerAddress().c_str());
int error = Remote()->SendRequest(WIFI_CBK_CMD_CONNECT_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CONNECT_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_CONNECT_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CONNECT_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -216,9 +229,11 @@ void WifiP2pCallbackProxy::OnP2pDiscoveryChanged(bool isChange)
}
data.WriteInt32(0);
data.WriteBool(isChange);
int error = Remote()->SendRequest(WIFI_CBK_CMD_DISCOVERY_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_DISCOVERY_CHANGE), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_DISCOVERY_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_DISCOVERY_CHANGE), error);
return;
}
int exception = reply.ReadInt32();
@ -241,9 +256,11 @@ void WifiP2pCallbackProxy::OnP2pActionResult(P2pActionCallback action, ErrCode c
data.WriteInt32(0);
data.WriteInt32(static_cast<int>(action));
data.WriteInt32(static_cast<int>(code));
int error = Remote()->SendRequest(WIFI_CBK_CMD_P2P_ACTION_RESULT, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_ACTION_RESULT), data,
reply, option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_P2P_ACTION_RESULT, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_ACTION_RESULT), error);
return;
}
int exception = reply.ReadInt32();
@ -267,9 +284,11 @@ void WifiP2pCallbackProxy::OnConfigChanged(CfgType type, char* cfgData, int data
data.WriteInt32(static_cast<int>(type));
data.WriteInt32(dataLen);
data.WriteBuffer(cfgData, dataLen);
int error = Remote()->SendRequest(WIFI_CBK_CMD_CFG_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE), data, reply,
option);
if (error != ERR_NONE) {
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d", WIFI_CBK_CMD_CFG_CHANGE, error);
WIFI_LOGE("Set Attr(%{public}d) failed,error code is %{public}d",
static_cast<int32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE), error);
return;
}
int exception = reply.ReadInt32();

View File

@ -19,6 +19,7 @@
#include "wifi_p2p_callback_proxy.h"
#include "wifi_p2p_death_recipient.h"
#include "wifi_common_def.h"
#include "wifi_manager_service_ipc_interface_code.h"
DEFINE_WIFILOG_P2P_LABEL("WifiP2pStub");
@ -32,50 +33,95 @@ WifiP2pStub::WifiP2pStub() : mSingleCallback(false)
WifiP2pStub::~WifiP2pStub()
{}
void WifiP2pStub::InitHandleMapEx()
{
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REGISTER_CALLBACK)] =
&WifiP2pStub::OnRegisterCallBack;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES)] =
&WifiP2pStub::OnGetSupportedFeatures;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_DEVICE_NAME)] =
&WifiP2pStub::OnSetP2pDeviceName;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_SET_WFD_INFO)] =
&WifiP2pStub::OnSetP2pWfdInfo;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_APPLY_IP)] =
&WifiP2pStub::OnHid2dRequestGcIp;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE)] =
&WifiP2pStub::OnHid2dSharedlinkIncrease;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE)] =
&WifiP2pStub::OnHid2dSharedlinkDecrease;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP)] =
&WifiP2pStub::OnHid2dCreateGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP)] =
&WifiP2pStub::OnHid2dRemoveGcGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONNECT)] =
&WifiP2pStub::OnHid2dConnect;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP)] =
&WifiP2pStub::OnHid2dConfigIPAddr;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP)] =
&WifiP2pStub::OnHid2dReleaseIPAddr;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL)] =
&WifiP2pStub::OnHid2dGetRecommendChannel;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_5G_CHANNEL_LIST)] =
&WifiP2pStub::OnHid2dGetChannelListFor5G;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_GET_SELF_WIFI_CFG)] =
&WifiP2pStub::OnHid2dGetSelfWifiCfgInfo;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_PEER_WIFI_CFG)] =
&WifiP2pStub::OnHid2dSetPeerWifiCfgInfo;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE)] =
&WifiP2pStub::OnQueryP2pLocalDevice;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_SET_UPPER_SCENE)] =
&WifiP2pStub::OnHid2dSetUpperScene;
return;
}
void WifiP2pStub::InitHandleMap()
{
handleFuncMap[WIFI_SVR_CMD_P2P_ENABLE] = &WifiP2pStub::OnEnableP2p;
handleFuncMap[WIFI_SVR_CMD_P2P_DISABLE] = &WifiP2pStub::OnDisableP2p;
handleFuncMap[WIFI_SVR_CMD_P2P_DISCOVER_DEVICES] = &WifiP2pStub::OnDiscoverDevices;
handleFuncMap[WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES] = &WifiP2pStub::OnStopDiscoverDevices;
handleFuncMap[WIFI_SVR_CMD_P2P_DISCOVER_SERVICES] = &WifiP2pStub::OnDiscoverServices;
handleFuncMap[WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES] = &WifiP2pStub::OnStopDiscoverServices;
handleFuncMap[WIFI_SVR_CMD_P2P_REQUEST_SERVICES] = &WifiP2pStub::OnRequestService;
handleFuncMap[WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES] = &WifiP2pStub::OnPutLocalP2pService;
handleFuncMap[WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES] = &WifiP2pStub::OnDeleteLocalP2pService;
handleFuncMap[WIFI_SVR_CMD_P2P_START_LISTEN] = &WifiP2pStub::OnStartP2pListen;
handleFuncMap[WIFI_SVR_CMD_P2P_STOP_LISTEN] = &WifiP2pStub::OnStopP2pListen;
handleFuncMap[WIFI_SVR_CMD_P2P_CREATE_GROUP] = &WifiP2pStub::OnCreateGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_REMOVE_GROUP] = &WifiP2pStub::OnRemoveGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_DELETE_GROUP] = &WifiP2pStub::OnDeleteGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_CONNECT] = &WifiP2pStub::OnP2pConnect;
handleFuncMap[WIFI_SVR_CMD_P2P_CANCEL_CONNECT] = &WifiP2pStub::OnP2pCancelConnect;
handleFuncMap[WIFI_SVR_CMD_P2P_QUERY_INFO] = &WifiP2pStub::OnQueryP2pLinkedInfo;
handleFuncMap[WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP] = &WifiP2pStub::OnGetCurrentGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS] = &WifiP2pStub::OnGetP2pEnableStatus;
handleFuncMap[WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS] = &WifiP2pStub::OnGetP2pDiscoverStatus;
handleFuncMap[WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS] = &WifiP2pStub::OnGetP2pConnectedStatus;
handleFuncMap[WIFI_SVR_CMD_P2P_QUERY_DEVICES] = &WifiP2pStub::OnQueryP2pDevices;
handleFuncMap[WIFI_SVR_CMD_P2P_QUERY_GROUPS] = &WifiP2pStub::OnQueryP2pGroups;
handleFuncMap[WIFI_SVR_CMD_P2P_QUERY_SERVICES] = &WifiP2pStub::OnQueryP2pServices;
handleFuncMap[WIFI_SVR_CMD_P2P_REGISTER_CALLBACK] = &WifiP2pStub::OnRegisterCallBack;
handleFuncMap[WIFI_SVR_CMD_GET_SUPPORTED_FEATURES] = &WifiP2pStub::OnGetSupportedFeatures;
handleFuncMap[WIFI_SVR_CMD_P2P_SET_DEVICE_NAME] = &WifiP2pStub::OnSetP2pDeviceName;
handleFuncMap[WIFI_SVR_CMD_P2P_SET_WFD_INFO] = &WifiP2pStub::OnSetP2pWfdInfo;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_APPLY_IP] = &WifiP2pStub::OnHid2dRequestGcIp;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_INCREASE] = &WifiP2pStub::OnHid2dSharedlinkIncrease;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_SHARED_LINK_DECREASE] = &WifiP2pStub::OnHid2dSharedlinkDecrease;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_CREATE_GROUP] = &WifiP2pStub::OnHid2dCreateGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_REMOVE_GC_GROUP] = &WifiP2pStub::OnHid2dRemoveGcGroup;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_CONNECT] = &WifiP2pStub::OnHid2dConnect;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_CONFIG_IP] = &WifiP2pStub::OnHid2dConfigIPAddr;
handleFuncMap[WIFI_SVR_CMD_P2P_HID2D_RELEASE_IP] = &WifiP2pStub::OnHid2dReleaseIPAddr;
handleFuncMap[WIFI_SVR_CMD_GET_P2P_RECOMMENDED_CHANNEL] = &WifiP2pStub::OnHid2dGetRecommendChannel;
handleFuncMap[WIFI_SVR_CMD_GET_5G_CHANNEL_LIST] = &WifiP2pStub::OnHid2dGetChannelListFor5G;
handleFuncMap[WIFI_SVR_CMD_GET_SELF_WIFI_CFG] = &WifiP2pStub::OnHid2dGetSelfWifiCfgInfo;
handleFuncMap[WIFI_SVR_CMD_SET_PEER_WIFI_CFG] = &WifiP2pStub::OnHid2dSetPeerWifiCfgInfo;
handleFuncMap[WIFI_SVR_CMD_P2P_QUERY_LOCAL_DEVICE] = &WifiP2pStub::OnQueryP2pLocalDevice;
handleFuncMap[WIFI_SVR_CMD_SET_UPPER_SCENE] = &WifiP2pStub::OnHid2dSetUpperScene;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_ENABLE)] = &WifiP2pStub::OnEnableP2p;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISABLE)] = &WifiP2pStub::OnDisableP2p;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_DEVICES)] =
&WifiP2pStub::OnDiscoverDevices;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_DEVICES)] =
&WifiP2pStub::OnStopDiscoverDevices;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DISCOVER_SERVICES)] =
&WifiP2pStub::OnDiscoverServices;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_DISCOVER_SERVICES)] =
&WifiP2pStub::OnStopDiscoverServices;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REQUEST_SERVICES)] =
&WifiP2pStub::OnRequestService;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_PUT_LOCAL_SERVICES)] =
&WifiP2pStub::OnPutLocalP2pService;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_LOCAL_SERVICES)] =
&WifiP2pStub::OnDeleteLocalP2pService;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_START_LISTEN)] =
&WifiP2pStub::OnStartP2pListen;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_STOP_LISTEN)] =
&WifiP2pStub::OnStopP2pListen;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CREATE_GROUP)] =
&WifiP2pStub::OnCreateGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_REMOVE_GROUP)] =
&WifiP2pStub::OnRemoveGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_DELETE_GROUP)] =
&WifiP2pStub::OnDeleteGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CONNECT)] = &WifiP2pStub::OnP2pConnect;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_CANCEL_CONNECT)] =
&WifiP2pStub::OnP2pCancelConnect;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_INFO)] =
&WifiP2pStub::OnQueryP2pLinkedInfo;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CURRENT_GROUP)] =
&WifiP2pStub::OnGetCurrentGroup;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_ENABLE_STATUS)] =
&WifiP2pStub::OnGetP2pEnableStatus;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_DISCOVER_STATUS)] =
&WifiP2pStub::OnGetP2pDiscoverStatus;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_GET_CONNECTED_STATUS)] =
&WifiP2pStub::OnGetP2pConnectedStatus;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_DEVICES)] =
&WifiP2pStub::OnQueryP2pDevices;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_GROUPS)] =
&WifiP2pStub::OnQueryP2pGroups;
handleFuncMap[static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_QUERY_SERVICES)] =
&WifiP2pStub::OnQueryP2pServices;
InitHandleMapEx();
return;
}

View File

@ -43,6 +43,7 @@ public:
private:
void InitHandleMap(void);
void InitHandleMapEx(void);
void OnEnableP2p(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
void OnDisableP2p(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
void OnDiscoverDevices(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);

View File

@ -16,6 +16,7 @@
#include "wifi_scan_callback_proxy.h"
#include "wifi_logger.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_internal_event_dispatcher.h"
DEFINE_WIFILOG_SCAN_LABEL("WifiScanCallbackProxy");
@ -40,7 +41,8 @@ void WifiScanCallbackProxy::OnWifiScanStateChanged(int state)
}
data.WriteInt32(0);
data.WriteInt32(state);
int error = Remote()->SendRequest(WIFI_CBK_CMD_SCAN_STATE_CHANGE, data, reply, option);
int error = Remote()->SendRequest(static_cast<uint32_t>(ScanInterfaceCode::WIFI_CBK_CMD_SCAN_STATE_CHANGE),
data, reply, option);
switch (error) {
case NO_ERROR:
WIFI_LOGD("OnWifiScanStateChanged callback succeeded!");

View File

@ -15,6 +15,7 @@
#include "wifi_scan_callback_proxy.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "wifi_logger.h"
@ -47,7 +48,8 @@ void WifiScanCallbackProxy::OnWifiScanStateChanged(int state)
MessageOption option;
MessageOptionInit(&option);
option.flags = TF_OP_ASYNC;
int ret = SendRequest(sid_, WIFI_CBK_CMD_SCAN_STATE_CHANGE, &data, &reply, option, nullptr);
int ret = SendRequest(sid_, static_cast<uint32_t>(ScanInterfaceCode::WIFI_CBK_CMD_SCAN_STATE_CHANGE), &data, &reply,
option, nullptr);
switch (ret) {
case ERR_NONE:
WIFI_LOGD("OnWifiScanStateChanged callback succeeded!");

View File

@ -17,6 +17,7 @@
#include "wifi_logger.h"
#include "wifi_msg.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_scan_callback_proxy.h"
#include "wifi_internal_event_dispatcher.h"
#include "wifi_scan_death_recipient.h"
@ -36,13 +37,19 @@ WifiScanStub::~WifiScanStub()
void WifiScanStub::InitHandleMap()
{
handleFuncMap[WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO] = &WifiScanStub::OnSetScanControlInfo;
handleFuncMap[WIFI_SVR_CMD_FULL_SCAN] = &WifiScanStub::OnScan;
handleFuncMap[WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN] = &WifiScanStub::OnScanByParams;
handleFuncMap[WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE] = &WifiScanStub::OnIsWifiClosedScan;
handleFuncMap[WIFI_SVR_CMD_GET_SCAN_INFO_LIST] = &WifiScanStub::OnGetScanInfoList;
handleFuncMap[WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK] = &WifiScanStub::OnRegisterCallBack;
handleFuncMap[WIFI_SVR_CMD_GET_SUPPORTED_FEATURES] = &WifiScanStub::OnGetSupportedFeatures;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO)] =
&WifiScanStub::OnSetScanControlInfo;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN)] = &WifiScanStub::OnScan;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN)] =
&WifiScanStub::OnScanByParams;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE)] =
&WifiScanStub::OnIsWifiClosedScan;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST)] =
&WifiScanStub::OnGetScanInfoList;
handleFuncMap[static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK)] =
&WifiScanStub::OnRegisterCallBack;
handleFuncMap[static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES)] =
&WifiScanStub::OnGetSupportedFeatures;
}
int WifiScanStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)

View File

@ -15,6 +15,7 @@
#include "wifi_scan_stub_lite.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "ipc_skeleton.h"
#include "rpc_errno.h"
#include "wifi_logger.h"
@ -64,31 +65,31 @@ int WifiScanStub::OnRemoteRequest(uint32_t code, IpcIo *req, IpcIo *reply)
int ret = -1;
switch (code) {
case WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO): {
ret = OnSetScanControlInfo(code, req, reply);
break;
}
case WIFI_SVR_CMD_FULL_SCAN: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN): {
ret = OnScan(code, req, reply);
break;
}
case WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN): {
ret = OnScanByParams(code, req, reply);
break;
}
case WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE): {
ret = OnIsWifiClosedScan(code, req, reply);
break;
}
case WIFI_SVR_CMD_GET_SCAN_INFO_LIST: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST): {
ret = OnGetScanInfoList(code, req, reply);
break;
}
case WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK: {
case static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK): {
ret = OnRegisterCallBack(code, req, reply);
break;
}
case WIFI_SVR_CMD_GET_SUPPORTED_FEATURES: {
case static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES): {
ret = OnGetSupportedFeatures(code, req, reply);
break;
}

View File

@ -23,6 +23,7 @@
#include "message_parcel.h"
#include "securec.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
namespace OHOS {
namespace Wifi {
@ -155,12 +156,14 @@ void OnGetSupportedFeaturesTest(const uint8_t* data, size_t size)
MessageParcel reply;
MessageOption option;
std::shared_ptr<WifiHotspotStub> pWifiHotspotStub = std::make_shared<WifiHotSpotStubFuzzTest>();
pWifiHotspotStub->OnRemoteRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, datas, reply, option);
pWifiHotspotStub->OnRemoteRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
datas, reply, option);
}
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
{
uint32_t code = U32_AT(data) % MAP_HOTSPOT_NUMS + WIFI_SVR_CMD_ENABLE_WIFI_AP;
uint32_t code = U32_AT(data) % MAP_HOTSPOT_NUMS +
static_cast<uint32_t>(HotspotInterfaceCode::WIFI_SVR_CMD_ENABLE_WIFI_AP);
MessageParcel datas;
datas.WriteInterfaceToken(FORMMGR_INTERFACE_TOKEN);
datas.WriteInt32(0);

View File

@ -23,6 +23,7 @@
#include "message_parcel.h"
#include "securec.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
namespace OHOS {
namespace Wifi {
@ -270,12 +271,13 @@ void OnGetSupportedFeaturesTest(const uint8_t* data, size_t size)
MessageParcel reply;
MessageOption option;
std::shared_ptr<WifiP2pStub> pWifiP2pStub = std::make_shared<WifiP2pStubFuzzTest>();
pWifiP2pStub->OnRemoteRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, datas, reply, option);
pWifiP2pStub->OnRemoteRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
datas, reply, option);
}
bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
{
uint32_t code = U32_AT(data) % MAP_P2P_NUMS + WIFI_SVR_CMD_P2P_ENABLE;
uint32_t code = U32_AT(data) % MAP_P2P_NUMS + static_cast<uint32_t>(P2PInterfaceCode::WIFI_SVR_CMD_P2P_ENABLE);
MessageParcel datas;
datas.WriteInterfaceToken(FORMMGR_INTERFACE_TOKEN);
datas.WriteInt32(0);

View File

@ -22,6 +22,7 @@
#include "message_parcel.h"
#include "securec.h"
#include "define.h"
#include "wifi_manager_service_ipc_interface_code.h"
#include "wifi_log.h"
namespace OHOS {
@ -79,8 +80,10 @@ void RemoteRequestSetScanControlInfo(const char* data, size_t size) // 1 WIFI_SV
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SET_SCAN_CONTROL_INFO), result);
}
void RemoteRequestFullScan(const char* data, size_t size) // 2 WIFI_SVR_CMD_FULL_SCAN
@ -92,8 +95,10 @@ void RemoteRequestFullScan(const char* data, size_t size) // 2 WIFI_SVR_CMD_FULL
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_FULL_SCAN, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_FULL_SCAN, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_FULL_SCAN), result);
}
void RemoteRequestSpecifiedParamsScan(const char* data, size_t size) // 3 WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN
@ -105,8 +110,10 @@ void RemoteRequestSpecifiedParamsScan(const char* data, size_t size) // 3 WIFI_S
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_SPECIFIED_PARAMS_SCAN), result);
}
void RemoteRequestIsScanAlwaysActive(const char* data, size_t size) // 4 WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE
@ -118,8 +125,10 @@ void RemoteRequestIsScanAlwaysActive(const char* data, size_t size) // 4 WIFI_SV
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_IS_SCAN_ALWAYS_ACTIVE), result);
}
void RemoteRequestGetScanInfoList(const char* data, size_t size) // 5 WIFI_SVR_CMD_GET_SCAN_INFO_LIST
@ -131,8 +140,10 @@ void RemoteRequestGetScanInfoList(const char* data, size_t size) // 5 WIFI_SVR_C
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_GET_SCAN_INFO_LIST, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_GET_SCAN_INFO_LIST, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_GET_SCAN_INFO_LIST), result);
}
void RemoteRequestRegisterCallBack(const char* data, size_t size) // 6 WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK
@ -144,8 +155,10 @@ void RemoteRequestRegisterCallBack(const char* data, size_t size) // 6 WIFI_SVR_
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK, result);
int result = pWifiScanStub->OnRemoteRequest(
static_cast<uint32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK), datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(ScanInterfaceCode::WIFI_SVR_CMD_REGISTER_SCAN_CALLBACK), result);
}
void RemoteRequestGetSupportedFeatures(const char* data, size_t size) // 7 WIFI_SVR_CMD_GET_SUPPORTED_FEATURES
@ -157,8 +170,11 @@ void RemoteRequestGetSupportedFeatures(const char* data, size_t size) // 7 WIFI_
datas.RewindRead(0);
MessageParcel reply;
MessageOption option;
int result = pWifiScanStub->OnRemoteRequest(WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)", WIFI_SVR_CMD_GET_SUPPORTED_FEATURES, result);
int result =
pWifiScanStub->OnRemoteRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES),
datas, reply, option);
LOGI("wifiscanstub_fuzzer OnRemoteRequest(0x%{public}x %{public}d)",
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_GET_SUPPORTED_FEATURES), result);
}
bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)

View File

@ -16,6 +16,7 @@
#include <gmock/gmock.h>
#include "wifi_device_callback_stub.h"
#include "wifi_logger.h"
#include "wifi_manager_service_ipc_interface_code.h"
using ::testing::_;
using ::testing::AtLeast;
@ -114,7 +115,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest1, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest2, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest2 enter");
uint32_t code = WIFI_CBK_CMD_STATE_CHANGE;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STATE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -135,7 +136,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest2, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest3, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest3 enter");
uint32_t code = WIFI_CBK_CMD_CONNECTION_CHANGE;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_CONNECTION_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -155,7 +156,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest3, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest4, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest4 enter");
uint32_t code = WIFI_CBK_CMD_RSSI_CHANGE;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_RSSI_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -175,7 +176,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest4, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest5, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest5 enter");
uint32_t code = WIFI_CBK_CMD_WPS_STATE_CHANGE;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_WPS_STATE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -195,7 +196,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest5, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest6, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest6 enter");
uint32_t code = WIFI_CBK_CMD_STREAM_DIRECTION;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_STREAM_DIRECTION);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -215,7 +216,7 @@ HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest6, TestSize.Level1)
HWTEST_F(WifiDeviceCallBackStubTest, OnRemoteRequestTest7, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest7 enter");
uint32_t code = WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE;
uint32_t code = static_cast<uint32_t>(DevInterfaceCode::WIFI_CBK_CMD_DEVICE_CONFIG_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;

View File

@ -21,6 +21,7 @@
#include "securec.h"
#include "wifi_logger.h"
#include "wifi_errcode.h"
#include "wifi_manager_service_ipc_interface_code.h"
using ::testing::Return;
using ::testing::ext::TestSize;
@ -183,7 +184,7 @@ HWTEST_F(WifiHotspotCallbackStubTest, OnHotspotStateChanged_001, TestSize.Level1
MessageParcel data;
MessageParcel reply;
MessageOption option;
uint32_t code = WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE;
uint32_t code = static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_CHANGE);
if (!data.WriteInterfaceToken(IWifiHotspotCallback::GetDescriptor())) {
return;
}
@ -209,7 +210,7 @@ HWTEST_F(WifiHotspotCallbackStubTest, OnHotspotStaJoin_001, TestSize.Level1)
MessageParcel data;
MessageParcel reply;
MessageOption option;
uint32_t code = WIFI_CBK_CMD_HOTSPOT_STATE_JOIN;
uint32_t code = static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_JOIN);
if (!data.WriteInterfaceToken(IWifiHotspotCallback::GetDescriptor())) {
return;
}
@ -234,7 +235,7 @@ HWTEST_F(WifiHotspotCallbackStubTest, OnHotspotStaLeave_001, TestSize.Level1)
MessageParcel data;
MessageParcel reply;
MessageOption option;
uint32_t code = WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE;
uint32_t code = static_cast<uint32_t>(HotspotInterfaceCode::WIFI_CBK_CMD_HOTSPOT_STATE_LEAVE);
if (!data.WriteInterfaceToken(IWifiHotspotCallback::GetDescriptor())) {
return;
}

View File

@ -16,6 +16,7 @@
#include <gmock/gmock.h>
#include "wifi_logger.h"
#include "wifi_p2p_callback_stub.h"
#include "wifi_manager_service_ipc_interface_code.h"
using ::testing::_;
using ::testing::AtLeast;
@ -139,7 +140,7 @@ HWTEST_F(WifiP2pCallbackStubTest, OnRemoteRequestTest2, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pStateChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pStateChangedTest enter");
uint32_t code = WIFI_CBK_CMD_P2P_STATE_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_STATE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -160,7 +161,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pStateChangedTest, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPersistentGroupsChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pPersistentGroupsChangedTest enter");
uint32_t code = WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PERSISTENT_GROUPS_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -180,7 +181,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPersistentGroupsChangedTest, TestSi
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pThisDeviceChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pThisDeviceChangedTest enter");
uint32_t code = WIFI_CBK_CMD_THIS_DEVICE_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_THIS_DEVICE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -200,7 +201,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pThisDeviceChangedTest, TestSize.Lev
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPeersChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pPeersChangedTest enter");
uint32_t code = WIFI_CBK_CMD_PEER_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PEER_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -222,7 +223,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPeersChangedTest, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPeersChangedTest2, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pPeersChangedTest2 enter");
uint32_t code = WIFI_CBK_CMD_PEER_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_PEER_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -237,7 +238,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pPeersChangedTest2, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pServicesChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pServicesChangedTest enter");
uint32_t code = WIFI_CBK_CMD_SERVICE_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_SERVICE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -259,7 +260,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pServicesChangedTest, TestSize.Level
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pServicesChangedTest2, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pServicesChangedTest2 enter");
uint32_t code = WIFI_CBK_CMD_SERVICE_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_SERVICE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -274,7 +275,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pServicesChangedTest2, TestSize.Leve
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pConnectionChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pConnectionChangedTest enter");
uint32_t code = WIFI_CBK_CMD_CONNECT_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CONNECT_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -294,7 +295,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pConnectionChangedTest, TestSize.Lev
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pDiscoveryChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pDiscoveryChangedTest enter");
uint32_t code = WIFI_CBK_CMD_DISCOVERY_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_DISCOVERY_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -314,7 +315,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pDiscoveryChangedTest, TestSize.Leve
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pActionResultTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnP2pActionResultTest enter");
uint32_t code = WIFI_CBK_CMD_P2P_ACTION_RESULT;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_P2P_ACTION_RESULT);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -334,7 +335,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnP2pActionResultTest, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnConfigChangedTest, TestSize.Level1)
{
WIFI_LOGI("RemoteOnConfigChangedTest enter");
uint32_t code = WIFI_CBK_CMD_CFG_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -349,7 +350,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnConfigChangedTest, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnConfigChangedTest1, TestSize.Level1)
{
WIFI_LOGI("RemoteOnConfigChangedTest1 enter");
uint32_t code = WIFI_CBK_CMD_CFG_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -365,7 +366,7 @@ HWTEST_F(WifiP2pCallbackStubTest, RemoteOnConfigChangedTest1, TestSize.Level1)
HWTEST_F(WifiP2pCallbackStubTest, RemoteOnConfigChangedTest2, TestSize.Level1)
{
WIFI_LOGI("RemoteOnConfigChangedTest2 enter");
uint32_t code = WIFI_CBK_CMD_CFG_CHANGE;
uint32_t code = static_cast<uint32_t>(P2PInterfaceCode::WIFI_CBK_CMD_CFG_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;

View File

@ -20,6 +20,7 @@
#include <cstdint>
#include "securec.h"
#include "wifi_logger.h"
#include "wifi_manager_service_ipc_interface_code.h"
using ::testing::Return;
using ::testing::ext::TestSize;
@ -96,7 +97,7 @@ HWTEST_F(WifiScanCallbackStubTest, OnRemoteRequestTest, TestSize.Level1)
HWTEST_F(WifiScanCallbackStubTest, OnRemoteRequestTest1, TestSize.Level1)
{
WIFI_LOGI("OnRemoteRequestTest1 ENTER");
uint32_t code = WIFI_CBK_CMD_SCAN_STATE_CHANGE;
uint32_t code = static_cast<uint32_t>(ScanInterfaceCode::WIFI_CBK_CMD_SCAN_STATE_CHANGE);
MessageParcel data;
MessageParcel reply;
MessageOption option;