suppression ble networking for winpc

Signed-off-by: suntaostyle1 <suntao89@huawei.com>
This commit is contained in:
suntaostyle1 2024-08-31 14:25:27 +08:00
parent 71eb2e163d
commit 67c934430c
11 changed files with 66 additions and 34 deletions

View File

@ -250,6 +250,7 @@ static void RequestEnableDiscovery(void *para)
void LnnRequestBleDiscoveryProcess(int32_t strategy, int64_t timeout)
{
LNN_LOGI(LNN_HEART_BEAT, "LnnRequestBleDiscoveryProcess enter");
if (strategy == REQUEST_DISABLE_BLE_DISCOVERY) {
if (g_hbConditionState.isRequestDisable) {
LNN_LOGI(LNN_HEART_BEAT, "ble has been requestDisabled, need wait timeout or enabled");

View File

@ -53,6 +53,7 @@ LNN_ASSIGNER(Errcode, ConnOnlineReason, connOnlineReason)
LNN_ASSIGNER(Int32, LaneId, laneId)
LNN_ASSIGNER(Int32, ChanReqId, chanReqId)
LNN_ASSIGNER(Int32, ConnReqId, connReqId)
LNN_ASSIGNER(Int32, Strategy, strategy)
LNN_ASSIGNER(String, PeerDeviceInfo, peerDeviceInfo)
LNN_ASSIGNER(AnonymizeString, PeerIp, peerIp)
LNN_ASSIGNER(AnonymizeString, PeerBrMac, peerBrMac)
@ -68,41 +69,42 @@ LNN_ASSIGNER(AnonymizeString, PeerUdidHash, peerUdidHash)
LNN_ASSIGNER(String, CallerPkg, callerPkg)
LNN_ASSIGNER(String, CalleePkg, calleePkg)
#define LNN_ASSIGNER_SIZE 33 // Size of g_connAssigners
#define LNN_ASSIGNER_SIZE 34 // Size of g_connAssigners
static const HiSysEventParamAssigner g_lnnAssigners[] = {
{ "STAGE_RES", HISYSEVENT_INT32, LnnAssignerResult },
{ "ERROR_CODE", HISYSEVENT_INT32, LnnAssignerErrcode },
{ "AUTH_ID", HISYSEVENT_INT32, LnnAssignerAuthId },
{ "DISC_SERVER_TYPE", HISYSEVENT_INT32, LnnAssignerDiscServerType },
{ "GEAR_CYCLE", HISYSEVENT_INT32, LnnAssignerGearCycle },
{ "GEAR_DURATION", HISYSEVENT_INT32, LnnAssignerGearDuration },
{ "CONN_ID", HISYSEVENT_INT32, LnnAssignerConnectionId },
{ "AUTH_LINK_TYPE", HISYSEVENT_INT32, LnnAssignerAuthLinkType },
{ "AUTH_REQUEST_ID", HISYSEVENT_INT32, LnnAssignerAuthRequestId },
{ "AUTH_COST_TIME", HISYSEVENT_INT32, LnnAssignerAuthCostTime },
{ "LNN_TYPE", HISYSEVENT_INT32, LnnAssignerLnnType },
{ "ONLINE_NUM", HISYSEVENT_INT32, LnnAssignerOnlineNum },
{ "PEER_DEV_ABILITY", HISYSEVENT_INT32, LnnAssignerPeerDeviceAbility},
{ "ONLINE_TYPE", HISYSEVENT_INT32, LnnAssignerOnlineType },
{ "OS_TYPE", HISYSEVENT_INT32, LnnAssignerOsType },
{ "CONN_ONLINE_REAS", HISYSEVENT_INT32, LnnAssignerConnOnlineReason },
{ "LANE_ID", HISYSEVENT_INT32, LnnAssignerLaneId },
{ "CHAN_REQ_ID", HISYSEVENT_INT32, LnnAssignerChanReqId },
{ "CONN_REQ_ID", HISYSEVENT_INT32, LnnAssignerConnReqId },
{ "PEER_DEV_INFO", HISYSEVENT_STRING, LnnAssignerPeerDeviceInfo },
{ "PEER_IP", HISYSEVENT_STRING, LnnAssignerPeerIp },
{ "PEER_BR_MAC", HISYSEVENT_STRING, LnnAssignerPeerBrMac },
{ "PEER_BLE_MAC", HISYSEVENT_STRING, LnnAssignerPeerBleMac },
{ "PEER_WIFI_MAC", HISYSEVENT_STRING, LnnAssignerPeerWifiMac },
{ "PEER_PORT", HISYSEVENT_STRING, LnnAssignerPeerPort },
{ "PEER_UDID", HISYSEVENT_STRING, LnnAssignerPeerUdid },
{ "PEER_NET_ID", HISYSEVENT_STRING, LnnAssignerPeerNetworkId },
{ "LOCAL_DEV_TYPE", HISYSEVENT_STRING, LnnAssignerLocalDeviceType },
{ "PEER_DEV_TYPE", HISYSEVENT_STRING, LnnAssignerPeerDeviceType },
{ "LOCAL_UDID_HASH", HISYSEVENT_STRING, LnnAssignerLocalUdidHash },
{ "PEER_UDID_HASH", HISYSEVENT_STRING, LnnAssignerPeerUdidHash },
{ "HOST_PKG", HISYSEVENT_STRING, LnnAssignerCallerPkg },
{ "TO_CALL_PKG", HISYSEVENT_STRING, LnnAssignerCalleePkg },
{ "STAGE_RES", HISYSEVENT_INT32, LnnAssignerResult },
{ "ERROR_CODE", HISYSEVENT_INT32, LnnAssignerErrcode },
{ "AUTH_ID", HISYSEVENT_INT32, LnnAssignerAuthId },
{ "DISC_SERVER_TYPE", HISYSEVENT_INT32, LnnAssignerDiscServerType },
{ "GEAR_CYCLE", HISYSEVENT_INT32, LnnAssignerGearCycle },
{ "GEAR_DURATION", HISYSEVENT_INT32, LnnAssignerGearDuration },
{ "CONN_ID", HISYSEVENT_INT32, LnnAssignerConnectionId },
{ "AUTH_LINK_TYPE", HISYSEVENT_INT32, LnnAssignerAuthLinkType },
{ "AUTH_REQUEST_ID", HISYSEVENT_INT32, LnnAssignerAuthRequestId },
{ "AUTH_COST_TIME", HISYSEVENT_INT32, LnnAssignerAuthCostTime },
{ "LNN_TYPE", HISYSEVENT_INT32, LnnAssignerLnnType },
{ "ONLINE_NUM", HISYSEVENT_INT32, LnnAssignerOnlineNum },
{ "PEER_DEV_ABILITY", HISYSEVENT_INT32, LnnAssignerPeerDeviceAbility},
{ "ONLINE_TYPE", HISYSEVENT_INT32, LnnAssignerOnlineType },
{ "OS_TYPE", HISYSEVENT_INT32, LnnAssignerOsType },
{ "CONN_ONLINE_REAS", HISYSEVENT_INT32, LnnAssignerConnOnlineReason },
{ "LANE_ID", HISYSEVENT_INT32, LnnAssignerLaneId },
{ "CHAN_REQ_ID", HISYSEVENT_INT32, LnnAssignerChanReqId },
{ "CONN_REQ_ID", HISYSEVENT_INT32, LnnAssignerConnReqId },
{ "STRATEGY_FOR_LNN_BLE", HISYSEVENT_INT32, LnnAssignerStrategy },
{ "PEER_DEV_INFO", HISYSEVENT_STRING, LnnAssignerPeerDeviceInfo },
{ "PEER_IP", HISYSEVENT_STRING, LnnAssignerPeerIp },
{ "PEER_BR_MAC", HISYSEVENT_STRING, LnnAssignerPeerBrMac },
{ "PEER_BLE_MAC", HISYSEVENT_STRING, LnnAssignerPeerBleMac },
{ "PEER_WIFI_MAC", HISYSEVENT_STRING, LnnAssignerPeerWifiMac },
{ "PEER_PORT", HISYSEVENT_STRING, LnnAssignerPeerPort },
{ "PEER_UDID", HISYSEVENT_STRING, LnnAssignerPeerUdid },
{ "PEER_NET_ID", HISYSEVENT_STRING, LnnAssignerPeerNetworkId },
{ "LOCAL_DEV_TYPE", HISYSEVENT_STRING, LnnAssignerLocalDeviceType },
{ "PEER_DEV_TYPE", HISYSEVENT_STRING, LnnAssignerPeerDeviceType },
{ "LOCAL_UDID_HASH", HISYSEVENT_STRING, LnnAssignerLocalUdidHash },
{ "PEER_UDID_HASH", HISYSEVENT_STRING, LnnAssignerPeerUdidHash },
{ "HOST_PKG", HISYSEVENT_STRING, LnnAssignerCallerPkg },
{ "TO_CALL_PKG", HISYSEVENT_STRING, LnnAssignerCalleePkg },
// Modification Note: remember updating LNN_ASSIGNER_SIZE
};

View File

@ -116,6 +116,7 @@ static ApiNameIdMap g_apiNameIdMapTbl[] = {
{SERVER_GET_ALL_META_NODE_INFO, "GetAllMetaNodeInfo"},
{SERVER_SHIFT_LNN_GEAR, "ShiftLNNGear"},
{SERVER_RIPPLE_STATS, "RippleStats"},
{SERVER_CTRL_LNN_BLE_HB, "CtrlLNNBleHb"},
};
typedef struct {

View File

@ -45,6 +45,7 @@ typedef enum {
EVENT_STAGE_LNN_SHIFT_GEAR = 6,
EVENT_STAGE_LNN_ROUTE_SELECT_START = 7,
EVENT_STAGE_LNN_ROUTE_SELECT_END = 8,
EVENT_STAGE_LNN_CTRL_BLE = 9,
} LnnEventLnnStage;
typedef enum {
@ -110,6 +111,7 @@ typedef struct {
int32_t laneId; // LANE_ID
int32_t chanReqId; // CHAN_REQ_ID
int32_t connReqId; // CONN_REQ_ID
int32_t strategy; // STRATEGY_FOR_LNN_BLE
const char *peerDeviceInfo; // PEER_DEV_INFO
const char *peerIp; // PEER_IP
const char *peerBrMac; // PEER_BR_MAC

View File

@ -79,6 +79,7 @@ enum SoftBusFuncId {
SERVER_REG_DATA_LEVEL_CHANGE_CB,
SERVER_UNREG_DATA_LEVEL_CHANGE_CB,
SERVER_SET_DATA_LEVEL,
SERVER_CTRL_LNN_BLE_HB,
CLIENT_ON_CHANNEL_OPENED = 256,
CLIENT_ON_CHANNEL_OPENFAILED,

View File

@ -140,6 +140,7 @@ BUSCENTER_BEHAVIOR:
ONLINE_TYPE: { type: INT32, desc: online type }
OS_TYPE: { type: INT32, desc: os type }
CONN_ONLINE_REASON: { type: UINT32, desc: connect online reason }
STRATEGY_FOR_LNN_BLE: { type: UINT32, desc: strategy for lnn ble }
PEER_DEV_INFO: { type: STRING, desc: peer device lnn info }
PEER_IP: { type: STRING, desc: peer device ip }
PEER_BR_MAC: { type: STRING, desc: peer device br mac }

View File

@ -556,6 +556,18 @@ typedef struct {
ExchangeMedium medium;
} InnerDeviceInfoAddtions;
/**
* @brief Defines the capability enumeration of suppressing and restoring ble.
* the value same as lnn_heartbeat_utils.h
*
*/
typedef enum {
/* Suppress ble */
REQUEST_DISABLE_BLE_DISCOVERY = 100,
/* Restore ble */
REQUEST_ENABLE_BLE_DISCOVERY,
} StrategyForBle;
#ifdef __cplusplus
}
#endif

View File

@ -519,6 +519,14 @@ enum SoftBusErrNo {
SOFTBUS_NETWORK_UNPACK_DATA_FAILED,
SOFTBUS_NETWORK_PACK_DATA_FAILED,
SOFTBUS_NETWORK_SET_NODE_INFO_ERR,
SOFTBUS_NETWORK_REMOTE_NULL,
SOFTBUS_NETWORK_WRITETOKEN_FAILED,
SOFTBUS_NETWORK_WRITECSTRING_FAILED,
SOFTBUS_NETWORK_WRITEINT32_FAILED,
SOFTBUS_NETWORK_READCSTRING_FAILED,
SOFTBUS_NETWORK_READINT32_FAILED,
SOFTBUS_NETWORK_SEND_REQUEST_FAILED,
SOFTBUS_NETWORK_REJECT_REQUEST,
/* errno begin: -((203 << 21) | (4 << 16) | (1 << 12) | 0x0FFF) */
SOFTBUS_LANE_ERR_BASE = SOFTBUS_SUB_ERRNO(LNN_SUB_MODULE_CODE, LNN_LANE_MODULE_CODE),

View File

@ -512,6 +512,7 @@
"RegisterFileSchema";
"UnRegisterFileSchema";
"SoftBusDFileSetSessionOpt";
"CtrlLNNBleHb";
extern "C++" {
OHOS::StreamAdaptor*;
Communication::SoftBus*;

View File

@ -81,6 +81,7 @@ MATCHER_P2(LnnValidParamArrayMatcher, inExtra, validSize, "lnn valid param array
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.laneId);
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.chanReqId);
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.connReqId);
MatchLnnEventNameTypeExtraInt32Param(params, ++index, extra.strategy);
MatchLnnEventNameTypeExtraStrParam(params, ++index, extra.peerDeviceInfo);
MatchLnnEventNameTypeExtraStrParamAnony(params, ++index, extra.peerIp);
MatchLnnEventNameTypeExtraStrParamAnony(params, ++index, extra.peerBrMac);

View File

@ -79,6 +79,7 @@ HWTEST_F(LnnEventTest, LnnEventTest002, TestSize.Level0)
.laneId = 17,
.chanReqId = 18,
.connReqId = 19,
.strategy = 20,
.peerDeviceInfo = "testPeerDeviceInfo",
.peerIp = "10.11.12.1",
.peerBrMac = "dd:15:bc:b9:f2:04",
@ -132,6 +133,7 @@ HWTEST_F(LnnEventTest, LnnEventTest003, TestSize.Level0)
.laneId = -17,
.chanReqId = -18,
.connReqId = -19,
.strategy = -20,
.peerDeviceInfo = "",
.peerIp = "",
.peerBrMac = "",