mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
feat:add osType and devType for Dfx
Signed-off-by: weiqian <weiqian22@huawei.com>
This commit is contained in:
parent
a004077737
commit
adb9619f2b
@ -26,5 +26,6 @@ if (dsoftbus_feature_lnn_net) {
|
||||
bus_center_disc_mgr_inc = [
|
||||
"$dsoftbus_root_path/core/bus_center/lnn/disc_mgr/include",
|
||||
"$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include",
|
||||
"$dsoftbus_root_path/core/common/dfx/interface/include/form",
|
||||
]
|
||||
bus_center_disc_mgr_deps = []
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "form/lnn_event_form.h"
|
||||
#include "softbus_bus_center.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -27,7 +28,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
void (*OnDeviceFound)(const ConnectionAddr *addr);
|
||||
void (*OnDeviceFound)(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport);
|
||||
} LnnDiscoveryImplCallback;
|
||||
|
||||
int32_t LnnInitCoapDiscovery(LnnDiscoveryImplCallback *callback);
|
||||
|
@ -56,6 +56,27 @@ static int32_t LnnCheckDiscoveryDeviceInfo(const DeviceInfo *device)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static int32_t GetConnectDeviceInfo(const DeviceInfo *device, ConnectionAddr *addr, LnnDfxDeviceInfoReport *info)
|
||||
{
|
||||
addr->type = device->addr[0].type;
|
||||
info->type = device->devType;
|
||||
if (strncpy_s(addr->info.ip.ip, IP_STR_MAX_LEN, device->addr[0].info.ip.ip, strlen(device->addr[0].info.ip.ip)) !=
|
||||
0) {
|
||||
LNN_LOGE(LNN_BUILDER, "strncpy ip failed");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
if (strcpy_s((char *)addr->info.ip.udidHash, UDID_HASH_LEN, device->devId) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy udidHash failed");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
addr->info.ip.port = device->addr[0].info.ip.port;
|
||||
if (memcpy_s(addr->peerUid, MAX_ACCOUNT_HASH_LEN, device->accountHash, MAX_ACCOUNT_HASH_LEN) != 0) {
|
||||
LNN_LOGE(LNN_BUILDER, "memcpy_s peer uid failed");
|
||||
return SOFTBUS_MEM_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void DeviceFound(const DeviceInfo *device, const InnerDeviceInfoAddtions *additions)
|
||||
{
|
||||
ConnectionAddr addr;
|
||||
@ -87,23 +108,14 @@ static void DeviceFound(const DeviceInfo *device, const InnerDeviceInfoAddtions
|
||||
LNN_LOGE(LNN_BUILDER, "get invalid device para");
|
||||
return;
|
||||
}
|
||||
addr.type = device->addr[0].type;
|
||||
if (strncpy_s(addr.info.ip.ip, IP_STR_MAX_LEN, device->addr[0].info.ip.ip, strlen(device->addr[0].info.ip.ip)) !=
|
||||
0) {
|
||||
LNN_LOGE(LNN_BUILDER, "strncpy ip failed");
|
||||
return;
|
||||
}
|
||||
if (strcpy_s((char *)addr.info.ip.udidHash, UDID_HASH_LEN, device->devId) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy udidHash failed");
|
||||
return;
|
||||
}
|
||||
addr.info.ip.port = device->addr[0].info.ip.port;
|
||||
if (memcpy_s(addr.peerUid, MAX_ACCOUNT_HASH_LEN, device->accountHash, MAX_ACCOUNT_HASH_LEN) != 0) {
|
||||
LNN_LOGE(LNN_BUILDER, "memcpy_s peer uid failed");
|
||||
LnnDfxDeviceInfoReport info;
|
||||
(void)memset_s(&info, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
if (GetConnectDeviceInfo(device, &addr, &info) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "get connect device info fail");
|
||||
return;
|
||||
}
|
||||
if (g_callback.OnDeviceFound) {
|
||||
g_callback.OnDeviceFound(&addr);
|
||||
g_callback.OnDeviceFound(&addr, &info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "softbus_errcode.h"
|
||||
#include "softbus_hisysevt_bus_center.h"
|
||||
|
||||
static void DeviceFound(const ConnectionAddr *addr);
|
||||
static void DeviceFound(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport);
|
||||
|
||||
typedef enum {
|
||||
LNN_DISC_IMPL_TYPE_COAP,
|
||||
@ -61,14 +61,14 @@ static void ReportDeviceFoundResultEvt(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void DeviceFound(const ConnectionAddr *addr)
|
||||
static void DeviceFound(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport)
|
||||
{
|
||||
if (addr == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "device addr is null\n");
|
||||
return;
|
||||
}
|
||||
ReportDeviceFoundResultEvt();
|
||||
if (LnnNotifyDiscoveryDevice(addr, true) != SOFTBUS_OK) {
|
||||
if (LnnNotifyDiscoveryDevice(addr, infoReport, true) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "notify device found failed\n");
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ typedef struct {
|
||||
#define P2P_GC (1 << 2)
|
||||
#define ENABLE_WIFI_CAP (1 << 3)
|
||||
#define DISABLE_BR_CAP (1 << 4)
|
||||
#define BLE_TRIGGER_HML (1 << 5)
|
||||
|
||||
typedef struct {
|
||||
int32_t (*onDataLevelChanged)(const char *networkId, const DataLevelInfo *dataLevelInfo);
|
||||
|
@ -503,12 +503,13 @@ static void CopyBleReportExtra(const LnnBleReportExtra *bleExtra, LnnEventExtra
|
||||
extra->result = bleExtra->extra.result;
|
||||
extra->localUdidHash = bleExtra->extra.localUdidHash;
|
||||
extra->peerUdidHash = bleExtra->extra.peerUdidHash;
|
||||
extra->osType = bleExtra->extra.osType;
|
||||
extra->peerDeviceType = bleExtra->extra.peerDeviceType;
|
||||
if (bleExtra->extra.peerNetworkId[0] != '\0') {
|
||||
extra->onlineType = bleExtra->extra.onlineType;
|
||||
extra->peerNetworkId = bleExtra->extra.peerNetworkId;
|
||||
extra->peerUdid = bleExtra->extra.peerUdid;
|
||||
extra->peerBleMac = bleExtra->extra.peerBleMac;
|
||||
extra->peerDeviceType = bleExtra->extra.peerDeviceType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -579,7 +580,7 @@ static int32_t HbAddAsyncProcessCallbackDelay(DeviceInfo *device)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static int32_t SoftBusNetNodeResult(DeviceInfo *device, bool isConnect)
|
||||
static int32_t SoftBusNetNodeResult(DeviceInfo *device, HbRespData *hbResp, bool isConnect)
|
||||
{
|
||||
char *anonyUdid = NULL;
|
||||
Anonymize(device->devId, &anonyUdid);
|
||||
@ -594,10 +595,16 @@ static int32_t SoftBusNetNodeResult(DeviceInfo *device, bool isConnect)
|
||||
return SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED;
|
||||
}
|
||||
}
|
||||
LnnDfxDeviceInfoReport info;
|
||||
(void)memset_s(&info, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
if (hbResp != NULL) {
|
||||
info.osType = ((hbResp->capabiltiy & BLE_TRIGGER_HML) != 0) ? OH_OS_TYPE : HO_OS_TYPE;
|
||||
}
|
||||
info.type = device->devType;
|
||||
if (HbAddAsyncProcessCallbackDelay(device) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_HEART_BEAT, "HbAddAsyncProcessCallbackDelay fail");
|
||||
}
|
||||
if (LnnNotifyDiscoveryDevice(device->addr, isConnect) != SOFTBUS_OK) {
|
||||
if (LnnNotifyDiscoveryDevice(device->addr, &info, isConnect) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_HEART_BEAT, "mgr recv process notify device found fail");
|
||||
return SOFTBUS_ERR;
|
||||
}
|
||||
@ -743,7 +750,7 @@ static int32_t HbNotifyReceiveDevice(DeviceInfo *device, const LnnHeartbeatWeigh
|
||||
LNN_LOGD(LNN_HEART_BEAT, "ignore lnn request, not support connect");
|
||||
return SOFTBUS_NETWORK_NOT_CONNECTABLE;
|
||||
}
|
||||
return SoftBusNetNodeResult(device, isConnect);
|
||||
return SoftBusNetNodeResult(device, hbResp, isConnect);
|
||||
}
|
||||
|
||||
static int32_t HbMediumMgrRecvProcess(DeviceInfo *device, const LnnHeartbeatWeight *mediumWeight,
|
||||
|
@ -66,6 +66,7 @@ typedef struct {
|
||||
uint32_t requestId;
|
||||
uint32_t flag;
|
||||
SoftBusVersion version;
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
} LnnConntionInfo;
|
||||
|
||||
struct tagLnnConnectionFsm;
|
||||
|
@ -134,6 +134,7 @@ typedef struct {
|
||||
char pkgName[PKG_NAME_SIZE_MAX];
|
||||
bool isNeedConnect;
|
||||
ConnectionAddr addr;
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
} JoinLnnMsgPara;
|
||||
|
||||
typedef struct {
|
||||
@ -145,7 +146,8 @@ int32_t LnnInitNetBuilder(void);
|
||||
int32_t LnnInitNetBuilderDelay(void);
|
||||
void LnnDeinitNetBuilder(void);
|
||||
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect);
|
||||
int32_t LnnNotifyDiscoveryDevice(
|
||||
const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport, bool isNeedConnect);
|
||||
void LnnSyncOfflineComplete(LnnSyncInfoType type, const char *networkId, const uint8_t *msg, uint32_t len);
|
||||
int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen);
|
||||
int32_t LnnRequestLeaveSpecific(const char *networkId, ConnectionAddrType addrType);
|
||||
|
@ -32,8 +32,7 @@ void TryElectAsMasterState(const char *networkId, bool isOnline);
|
||||
bool IsSupportMasterNodeElect(SoftBusVersion version);
|
||||
int32_t TryElectMasterNodeOnline(const LnnConnectionFsm *connFsm);
|
||||
int32_t TryElectMasterNodeOffline(const LnnConnectionFsm *connFsm);
|
||||
int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const ConnectionAddr *addr,
|
||||
const char* pkgName, bool isNeedConnect, bool needReportFailure);
|
||||
int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const JoinLnnMsgPara *para, bool needReportFailure);
|
||||
void SetBeginJoinLnnTime(LnnConnectionFsm *connFsm);
|
||||
LnnConnectionFsm *FindConnectionFsmByConnFsmId(uint16_t connFsmId);
|
||||
void TryInitiateNewNetworkOnline(const LnnConnectionFsm *connFsm);
|
||||
|
@ -576,10 +576,6 @@ static int32_t FillDeviceBleReportExtra(const LnnEventExtra *extra, LnnBleReport
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s peerBleMac fail");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
if (strcpy_s(bleExtra->extra.peerDeviceType, DEVICE_TYPE_SIZE_LEN + 1, extra->peerDeviceType) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s peerDeviceType fail");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
@ -594,6 +590,7 @@ static void DfxAddBleReportExtra(
|
||||
bleExtra->extra.errcode = extra->errcode;
|
||||
bleExtra->extra.lnnType = extra->lnnType;
|
||||
bleExtra->extra.result = extra->result;
|
||||
bleExtra->extra.osType = extra->osType;
|
||||
if (strcpy_s(bleExtra->extra.localUdidHash, HB_SHORT_UDID_HASH_HEX_LEN + 1, extra->localUdidHash) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s localUdidHash fail");
|
||||
return;
|
||||
@ -602,6 +599,10 @@ static void DfxAddBleReportExtra(
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s peerUdidHash fail");
|
||||
return;
|
||||
}
|
||||
if (strcpy_s(bleExtra->extra.peerDeviceType, DEVICE_TYPE_SIZE_LEN + 1, extra->peerDeviceType) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s peerDeviceType fail");
|
||||
return;
|
||||
}
|
||||
if (connInfo->nodeInfo == NULL) {
|
||||
bleExtra->status = BLE_REPORT_EVENT_FAIL;
|
||||
AddNodeToLnnBleReportExtraMap(bleExtra->extra.peerUdidHash, bleExtra);
|
||||
@ -621,6 +622,7 @@ static void DfxReportOnlineEvent(LnnConntionInfo *connInfo, int32_t reason, LnnE
|
||||
LNN_LOGE(LNN_BUILDER, "connInfo is NULL");
|
||||
return;
|
||||
}
|
||||
int32_t osType = connInfo->infoReport.osType;
|
||||
if (connInfo->addr.type == CONNECTION_ADDR_BLE) {
|
||||
LnnBleReportExtra bleExtra;
|
||||
(void)memset_s(&bleExtra, sizeof(LnnBleReportExtra), 0, sizeof(LnnBleReportExtra));
|
||||
@ -629,16 +631,34 @@ static void DfxReportOnlineEvent(LnnConntionInfo *connInfo, int32_t reason, LnnE
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_JOIN_LNN_END, extra);
|
||||
bleExtra.status = BLE_REPORT_EVENT_SUCCESS;
|
||||
AddNodeToLnnBleReportExtraMap(extra.peerUdidHash, &bleExtra);
|
||||
return;
|
||||
} else {
|
||||
extra.osType = osType;
|
||||
DfxAddBleReportExtra(connInfo, &extra, &bleExtra);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
LNN_EVENT(EVENT_SCENE_JOIN_LNN, EVENT_STAGE_JOIN_LNN_END, extra);
|
||||
}
|
||||
|
||||
static int32_t GetPeerConnInfo(const LnnConntionInfo *connInfo, char *netWorkId, char *bleMacAddr, char *deviceType)
|
||||
{
|
||||
if (strcpy_s(netWorkId, NETWORK_ID_BUF_LEN, connInfo->nodeInfo->networkId) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s netWorkId fail");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
if (strcpy_s(bleMacAddr, MAC_LEN, connInfo->nodeInfo->connectInfo.bleMacAddr) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s bleMacAddr fail");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
if (snprintf_s(deviceType, DEVICE_TYPE_SIZE_LEN + 1, DEVICE_TYPE_SIZE_LEN, "%X",
|
||||
connInfo->nodeInfo->deviceInfo.deviceTypeId) < 0) {
|
||||
LNN_LOGE(LNN_BUILDER, "snprintf_s deviceType fail");
|
||||
return SOFTBUS_STRCPY_ERR;
|
||||
}
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
static void DfxRecordLnnAddOnlineNodeEnd(LnnConntionInfo *connInfo, int32_t onlineNum, int32_t lnnType, int32_t reason)
|
||||
{
|
||||
LnnEventExtra extra = { 0 };
|
||||
@ -649,6 +669,7 @@ static void DfxRecordLnnAddOnlineNodeEnd(LnnConntionInfo *connInfo, int32_t onli
|
||||
extra.result = (reason == SOFTBUS_OK) ? EVENT_STAGE_RESULT_OK : EVENT_STAGE_RESULT_FAILED;
|
||||
char localUdidHash[HB_SHORT_UDID_HASH_HEX_LEN + 1] = { 0 };
|
||||
char peerUdidHash[HB_SHORT_UDID_HASH_HEX_LEN + 1] = { 0 };
|
||||
char deviceType[DEVICE_TYPE_SIZE_LEN + 1] = { 0 };
|
||||
if (GetUdidHashForDfx(localUdidHash, peerUdidHash, connInfo) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "get udidhash fail");
|
||||
return;
|
||||
@ -656,30 +677,29 @@ static void DfxRecordLnnAddOnlineNodeEnd(LnnConntionInfo *connInfo, int32_t onli
|
||||
extra.localUdidHash = localUdidHash;
|
||||
extra.peerUdidHash = peerUdidHash;
|
||||
if (connInfo->nodeInfo == NULL) {
|
||||
if (snprintf_s(deviceType, DEVICE_TYPE_SIZE_LEN + 1, DEVICE_TYPE_SIZE_LEN, "%X",
|
||||
(uint16_t)connInfo->infoReport.type) < 0) {
|
||||
LNN_LOGE(LNN_BUILDER, "snprintf_s deviceType by infoReport fail");
|
||||
return;
|
||||
}
|
||||
extra.peerDeviceType = deviceType;
|
||||
DfxReportOnlineEvent(connInfo, reason, extra);
|
||||
return;
|
||||
}
|
||||
SetOnlineType(reason, connInfo->nodeInfo, extra);
|
||||
char netWorkId[NETWORK_ID_BUF_LEN] = { 0 };
|
||||
if (strcpy_s(netWorkId, NETWORK_ID_BUF_LEN, connInfo->nodeInfo->networkId) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s netWorkId fail");
|
||||
return;
|
||||
}
|
||||
char udidData[UDID_BUF_LEN] = { 0 };
|
||||
char bleMacAddr[MAC_LEN] = { 0 };
|
||||
if (GetPeerUdidInfo(connInfo->nodeInfo, udidData, peerUdidHash) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "get peer udid fail");
|
||||
return;
|
||||
}
|
||||
char bleMacAddr[MAC_LEN] = { 0 };
|
||||
if (strcpy_s(bleMacAddr, MAC_LEN, connInfo->nodeInfo->connectInfo.bleMacAddr) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s bleMacAddr fail");
|
||||
if (GetPeerConnInfo(connInfo, netWorkId, bleMacAddr, deviceType) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "get peer connInfo fail");
|
||||
return;
|
||||
}
|
||||
char deviceType[DEVICE_TYPE_SIZE_LEN + 1] = { 0 };
|
||||
if (snprintf_s(deviceType, DEVICE_TYPE_SIZE_LEN + 1, DEVICE_TYPE_SIZE_LEN, "%X",
|
||||
connInfo->nodeInfo->deviceInfo.deviceTypeId) < 0) {
|
||||
LNN_LOGE(LNN_BUILDER, "snprintf_s deviceType fail");
|
||||
return;
|
||||
if (connInfo->addr.type == CONNECTION_ADDR_BLE) {
|
||||
extra.osType = connInfo->nodeInfo->deviceInfo.osType;
|
||||
}
|
||||
extra.peerNetworkId = netWorkId;
|
||||
extra.peerUdid = udidData;
|
||||
@ -1165,8 +1185,8 @@ bool LnnIsNeedCleanConnectionFsm(const NodeInfo *nodeInfo, ConnectionAddrType ty
|
||||
(void)memset_s(&oldNodeInfo, sizeof(NodeInfo), 0, sizeof(NodeInfo));
|
||||
|
||||
int32_t ret = LnnGetRemoteNodeInfoById(nodeInfo->deviceInfo.deviceUdid, CATEGORY_UDID, &oldNodeInfo);
|
||||
if (ret != SOFTBUS_OK || !LnnIsNodeOnline(&oldNodeInfo)) {
|
||||
LNN_LOGW(LNN_BUILDER, "device is not online, ret=%{public}d", ret);
|
||||
if (ret != SOFTBUS_OK || !LnnIsNodeOnline(nodeInfo)) {
|
||||
LNN_LOGW(LNN_BUILDER, "device is node online");
|
||||
return false;
|
||||
}
|
||||
if (IsBasicNodeInfoChanged(&oldNodeInfo, nodeInfo, false)) {
|
||||
|
@ -230,11 +230,12 @@ int32_t TrySendJoinLNNRequest(const JoinLnnMsgPara *para, bool needReportFailure
|
||||
SoftBusFree((void *)para);
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
ret = PostJoinRequestToConnFsm(connFsm, ¶->addr, para->pkgName, para->isNeedConnect, needReportFailure);
|
||||
ret = PostJoinRequestToConnFsm(connFsm, para, needReportFailure);
|
||||
SoftBusFree((void *)para);
|
||||
return ret;
|
||||
}
|
||||
connFsm->connInfo.flag |= (needReportFailure ? LNN_CONN_INFO_FLAG_JOIN_REQUEST : LNN_CONN_INFO_FLAG_JOIN_AUTO);
|
||||
connFsm->connInfo.infoReport = para->infoReport;
|
||||
if ((connFsm->connInfo.flag & LNN_CONN_INFO_FLAG_ONLINE) != 0) {
|
||||
if (connFsm->connInfo.addr.type == CONNECTION_ADDR_WLAN || connFsm->connInfo.addr.type == CONNECTION_ADDR_ETH) {
|
||||
char uuid[UUID_BUF_LEN] = {0};
|
||||
@ -695,11 +696,12 @@ static ConnectionAddr *CreateConnectionAddrMsgPara(const ConnectionAddr *addr)
|
||||
return para;
|
||||
}
|
||||
|
||||
static JoinLnnMsgPara *CreateJoinLnnMsgPara(const ConnectionAddr *addr, const char *pkgName, bool isNeedConnect)
|
||||
static JoinLnnMsgPara *CreateJoinLnnMsgPara(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
const char *pkgName, bool isNeedConnect)
|
||||
{
|
||||
JoinLnnMsgPara *para = NULL;
|
||||
|
||||
if (addr == NULL || pkgName == NULL) {
|
||||
if (addr == NULL || infoReport == NULL || pkgName == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "create join lnn msg para is null");
|
||||
return NULL;
|
||||
}
|
||||
@ -715,6 +717,7 @@ static JoinLnnMsgPara *CreateJoinLnnMsgPara(const ConnectionAddr *addr, const ch
|
||||
}
|
||||
para->isNeedConnect = isNeedConnect;
|
||||
para->addr = *addr;
|
||||
para->infoReport = *infoReport;
|
||||
return para;
|
||||
}
|
||||
|
||||
@ -958,7 +961,9 @@ int32_t LnnServerJoin(ConnectionAddr *addr, const char *pkgName)
|
||||
LNN_LOGE(LNN_BUILDER, "no init");
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
para = CreateJoinLnnMsgPara(addr, pkgName, true);
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
para = CreateJoinLnnMsgPara(addr, &infoReport, pkgName, true);
|
||||
if (para == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "prepare join lnn message fail");
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
@ -994,7 +999,8 @@ int32_t LnnServerLeave(const char *networkId, const char *pkgName)
|
||||
return SOFTBUS_OK;
|
||||
}
|
||||
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect)
|
||||
int32_t LnnNotifyDiscoveryDevice(
|
||||
const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport, bool isNeedConnect)
|
||||
{
|
||||
JoinLnnMsgPara *para = NULL;
|
||||
|
||||
@ -1004,7 +1010,11 @@ int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect)
|
||||
LNN_LOGE(LNN_BUILDER, "no init");
|
||||
return SOFTBUS_NO_INIT;
|
||||
}
|
||||
para = CreateJoinLnnMsgPara(addr, DEFAULT_PKG_NAME, isNeedConnect);
|
||||
if (infoReport == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "infoReport is null");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
para = CreateJoinLnnMsgPara(addr, infoReport, DEFAULT_PKG_NAME, isNeedConnect);
|
||||
if (para == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "malloc discovery device message fail");
|
||||
return SOFTBUS_MALLOC_ERR;
|
||||
|
@ -152,23 +152,26 @@ AuthVerifyCallback *LnnGetReAuthVerifyCallback(void)
|
||||
return &g_reAuthVerifyCallback;
|
||||
}
|
||||
|
||||
int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const ConnectionAddr *addr,
|
||||
const char* pkgName, bool isNeedConnect, bool needReportFailure)
|
||||
int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const JoinLnnMsgPara *para, bool needReportFailure)
|
||||
{
|
||||
if (para == NULL) {
|
||||
LNN_LOGE(LNN_BUILDER, "invalid param");
|
||||
return SOFTBUS_INVALID_PARAM;
|
||||
}
|
||||
int32_t rc = SOFTBUS_OK;
|
||||
bool isCreate = false;
|
||||
|
||||
if (connFsm == NULL) {
|
||||
connFsm = FindConnectionFsmByAddr(addr, false);
|
||||
connFsm = FindConnectionFsmByAddr(¶->addr, false);
|
||||
}
|
||||
if (connFsm == NULL || connFsm->isDead) {
|
||||
connFsm = StartNewConnectionFsm(addr, pkgName, isNeedConnect);
|
||||
connFsm = StartNewConnectionFsm(¶->addr, para->pkgName, para->isNeedConnect);
|
||||
isCreate = true;
|
||||
}
|
||||
if (connFsm == NULL || LnnSendJoinRequestToConnFsm(connFsm) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "process join lnn request failed");
|
||||
if (needReportFailure) {
|
||||
LnnNotifyJoinResult((ConnectionAddr *)addr, NULL, SOFTBUS_ERR);
|
||||
LnnNotifyJoinResult((ConnectionAddr *)¶->addr, NULL, SOFTBUS_ERR);
|
||||
}
|
||||
if (connFsm != NULL && isCreate) {
|
||||
LnnFsmRemoveMessageByType(&connFsm->fsm, FSM_CTRL_MSG_START);
|
||||
@ -179,8 +182,11 @@ int32_t PostJoinRequestToConnFsm(LnnConnectionFsm *connFsm, const ConnectionAddr
|
||||
rc = SOFTBUS_ERR;
|
||||
}
|
||||
if (rc == SOFTBUS_OK) {
|
||||
connFsm->connInfo.infoReport = para->infoReport;
|
||||
connFsm->connInfo.flag |=
|
||||
(needReportFailure ? LNN_CONN_INFO_FLAG_JOIN_REQUEST : LNN_CONN_INFO_FLAG_JOIN_AUTO);
|
||||
LNN_LOGI(LNN_BUILDER, "infoReport.osType=%{public}d, infoReport.type=%{public}X",
|
||||
connFsm->connInfo.infoReport.osType, connFsm->connInfo.infoReport.type);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -189,13 +195,22 @@ void TryRemovePendingJoinRequest(void)
|
||||
{
|
||||
PendingJoinRequestNode *item = NULL;
|
||||
PendingJoinRequestNode *next = NULL;
|
||||
JoinLnnMsgPara para;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(item, next, &LnnGetNetBuilder()->pendingList, PendingJoinRequestNode, node) {
|
||||
if (NeedPendingJoinRequest()) {
|
||||
return;
|
||||
}
|
||||
ListDelete(&item->node);
|
||||
if (PostJoinRequestToConnFsm(NULL, &item->addr, DEFAULT_PKG_NAME, true, item->needReportFailure)
|
||||
(void)memset_s(¶, sizeof(JoinLnnMsgPara), 0, sizeof(JoinLnnMsgPara));
|
||||
para.addr = item->addr;
|
||||
para.isNeedConnect = true;
|
||||
if (strcpy_s(para.pkgName, strlen(DEFAULT_PKG_NAME), DEFAULT_PKG_NAME) != EOK) {
|
||||
LNN_LOGE(LNN_BUILDER, "strcpy_s pkgName failed");
|
||||
SoftBusFree(item);
|
||||
continue;
|
||||
}
|
||||
if (PostJoinRequestToConnFsm(NULL, ¶, item->needReportFailure)
|
||||
!= SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "post pending join request failed");
|
||||
}
|
||||
|
@ -48,9 +48,11 @@ int32_t LnnServerLeave(const char *networkId, const char *pkgName)
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnec)
|
||||
int32_t LnnNotifyDiscoveryDevice(
|
||||
const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport, bool isNeedConnec)
|
||||
{
|
||||
(void)addr;
|
||||
(void)infoReport;
|
||||
(void)isNeedConnec;
|
||||
return SOFTBUS_NOT_IMPLEMENT;
|
||||
}
|
||||
|
@ -481,8 +481,10 @@ static void RestoreBrNetworkDevices(void)
|
||||
{
|
||||
DeviceNightMode *item = NULL;
|
||||
DeviceNightMode *next = NULL;
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
LIST_FOR_EACH_ENTRY_SAFE(item, next, g_nightOnCache, DeviceNightMode, node) {
|
||||
if (LnnNotifyDiscoveryDevice(&(item->addrs), true) != SOFTBUS_OK) {
|
||||
if (LnnNotifyDiscoveryDevice(&(item->addrs), &infoReport, true) != SOFTBUS_OK) {
|
||||
LNN_LOGE(LNN_BUILDER, "notify device found failed\n");
|
||||
}
|
||||
ListDelete(&item->node);
|
||||
|
@ -48,6 +48,7 @@ LNN_ASSIGNER(Int32, LnnType, lnnType)
|
||||
LNN_ASSIGNER(Int32, OnlineNum, onlineNum)
|
||||
LNN_ASSIGNER(Int32, PeerDeviceAbility, peerDeviceAbility)
|
||||
LNN_ASSIGNER(Int32, OnlineType, onlineType)
|
||||
LNN_ASSIGNER(Errcode, OsType, osType)
|
||||
LNN_ASSIGNER(String, PeerDeviceInfo, peerDeviceInfo)
|
||||
LNN_ASSIGNER(AnonymizeString, PeerIp, peerIp)
|
||||
LNN_ASSIGNER(AnonymizeString, PeerBrMac, peerBrMac)
|
||||
@ -78,6 +79,7 @@ static const HiSysEventParamAssigner g_lnnAssigners[] = {
|
||||
{ "ONLINE_NUM", HISYSEVENT_INT32, LnnAssignerOnlineNum },
|
||||
{ "PEER_DEV_ABILITY", HISYSEVENT_INT32, LnnAssignerPeerDeviceAbility},
|
||||
{ "ONLINE_TYPE", HISYSEVENT_INT32, LnnAssignerOnlineType },
|
||||
{ "OS_TYPE", HISYSEVENT_INT32, LnnAssignerOsType },
|
||||
{ "PEER_DEV_INFO", HISYSEVENT_STRING, LnnAssignerPeerDeviceInfo },
|
||||
{ "PEER_IP", HISYSEVENT_STRING, LnnAssignerPeerIp },
|
||||
{ "PEER_BR_MAC", HISYSEVENT_STRING, LnnAssignerPeerBrMac },
|
||||
|
@ -93,6 +93,7 @@ typedef struct {
|
||||
int32_t onlineNum; // ONLINE_NUM
|
||||
int32_t peerDeviceAbility; // PEER_DEV_ABILITY
|
||||
int32_t onlineType; // ONLINE_TYPE
|
||||
int32_t osType; // OS_TYPE
|
||||
const char *peerDeviceInfo; // PEER_DEV_INFO
|
||||
const char *peerIp; // PEER_IP
|
||||
const char *peerBrMac; // PEER_BR_MAC
|
||||
@ -114,6 +115,7 @@ typedef struct {
|
||||
int32_t lnnType; // LNN_TYPE
|
||||
int32_t onlineNum; // ONLINE_NUM
|
||||
int32_t onlineType; // ONLINE_TYPE
|
||||
int32_t osType; // OS_TYPE
|
||||
char peerBleMac[BT_MAC_LEN]; // PEER_BLE_MAC
|
||||
char peerUdid[UDID_BUF_LEN]; // PEER_UDID
|
||||
char peerNetworkId[NETWORK_ID_BUF_LEN]; // PEER_NET_ID
|
||||
@ -122,6 +124,11 @@ typedef struct {
|
||||
char peerUdidHash[HB_SHORT_UDID_HASH_HEX_LEN + 1]; // PEER_UDID_HASH
|
||||
} LnnReportEventExtra;
|
||||
|
||||
typedef struct {
|
||||
DeviceType type;
|
||||
int32_t osType;
|
||||
} LnnDfxDeviceInfoReport;
|
||||
|
||||
typedef enum {
|
||||
BLE_REPORT_EVENT_INIT = 1,
|
||||
BLE_REPORT_EVENT_FAIL = 2,
|
||||
|
@ -987,7 +987,9 @@ int32_t TransNotifyAuthDataSuccess(int32_t channelId, const ConnectOption *connO
|
||||
TRANS_LOGE(TRANS_SVC, "channelId convert addr fail. channelId=%{public}d", channelId);
|
||||
return SOFTBUS_TRANS_CHANNELID_CONVERT_ADDR_FAILED;
|
||||
}
|
||||
return LnnNotifyDiscoveryDevice(&addr, true);
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
return LnnNotifyDiscoveryDevice(&addr, &infoReport, true);
|
||||
}
|
||||
|
||||
int32_t TransAuthGetAppInfoByChanId(int32_t channelId, AppInfo *appInfo)
|
||||
|
@ -71,6 +71,7 @@ DISCOVER_BEHAVIOR:
|
||||
PEER_PORT: { type: STRING, desc: peer device port }
|
||||
PEER_NET_ID: { type: STRING, desc: peer device net id }
|
||||
PEER_DEV_TYPE: { type: STRING, desc: peer device type }
|
||||
OS_TYPE: { type: INT32, desc: peer os type}
|
||||
|
||||
DISCOVER_AUDIT:
|
||||
__BASE: {type: SECURITY, level: CRITICAL, desc: discovery security audit }
|
||||
|
@ -58,7 +58,9 @@ void LnnNotifyDiscoveryDeviceFuzzTest(const uint8_t* data, size_t size)
|
||||
COMM_LOGE(COMM_TEST, "memcpy_s ConnectionAddr is failed!");
|
||||
return;
|
||||
}
|
||||
LnnNotifyDiscoveryDevice(&addr, isNeedConnect);
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
LnnNotifyDiscoveryDevice(&addr, &infoReport, isNeedConnect);
|
||||
}
|
||||
|
||||
/* Fuzzer entry point */
|
||||
|
@ -66,13 +66,15 @@ HWTEST_F(NetBuilderMockTest, NET_BUILDER_TEST_001, TestSize.Level1)
|
||||
int32_t ret = LnnInitNetBuilder();
|
||||
EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
|
||||
ret = LnnNotifyDiscoveryDevice(nullptr, false);
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
ret = LnnNotifyDiscoveryDevice(nullptr, &infoReport, false);
|
||||
EXPECT_TRUE(ret != SOFTBUS_OK);
|
||||
|
||||
ConnectionAddr addr;
|
||||
addr.type = CONNECTION_ADDR_BR;
|
||||
(void)memcpy_s(addr.info.br.brMac, BT_MAC_LEN, "1A:22:3C:4D:5E:66", BT_MAC_LEN);
|
||||
ret = LnnNotifyDiscoveryDevice(&addr, false);
|
||||
ret = LnnNotifyDiscoveryDevice(&addr, &infoReport, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
|
||||
LnnDeinitNetBuilder();
|
||||
|
@ -87,13 +87,15 @@ HWTEST_F(LNNNetBuilderTest, LNN_NOTIFY_DISCOVERY_DEVICE_TEST_001, TestSize.Level
|
||||
.type = CONNECTION_ADDR_WLAN,
|
||||
.info.ip.port = PORT
|
||||
};
|
||||
LnnDfxDeviceInfoReport infoReport;
|
||||
(void)memset_s(&infoReport, sizeof(LnnDfxDeviceInfoReport), 0, sizeof(LnnDfxDeviceInfoReport));
|
||||
memcpy_s(target.peerUid, MAX_ACCOUNT_HASH_LEN, PEERUID, strlen(PEERUID));
|
||||
memcpy_s(target.info.ip.ip, IP_STR_MAX_LEN, IP, strlen(IP));
|
||||
int32_t ret = LnnNotifyDiscoveryDevice(&target, false);
|
||||
int32_t ret = LnnNotifyDiscoveryDevice(&target, &infoReport, false);
|
||||
EXPECT_TRUE(ret != SOFTBUS_OK);
|
||||
ret = LnnInitNetBuilder();
|
||||
EXPECT_TRUE(ret == SOFTBUS_OK);
|
||||
ret = LnnNotifyDiscoveryDevice(nullptr, false);
|
||||
ret = LnnNotifyDiscoveryDevice(nullptr, &infoReport, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_MALLOC_ERR);
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,10 @@ bool LnnGetOnlineStateById(const char *id, IdCategory type)
|
||||
{
|
||||
return GetNetworkManagerInterface()->LnnGetOnlineStateById(id, type);
|
||||
}
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect)
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect)
|
||||
{
|
||||
return GetNetworkManagerInterface()->LnnNotifyDiscoveryDevice(addr, isNeedConnect);
|
||||
return GetNetworkManagerInterface()->LnnNotifyDiscoveryDevice(addr, infoReport, isNeedConnect);
|
||||
}
|
||||
int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen)
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "bus_center_event.h"
|
||||
#include "disc_interface.h"
|
||||
#include "form/lnn_event_form.h"
|
||||
#include "lnn_distributed_net_ledger.h"
|
||||
#include "lnn_async_callback_utils.h"
|
||||
#include "lnn_network_manager.h"
|
||||
@ -46,7 +47,8 @@ public:
|
||||
virtual void LnnUpdateOhosAccount(bool isNeedUpdateHeartbeat) = 0;
|
||||
virtual void LnnOnOhosAccountLogout(void) = 0;
|
||||
virtual bool LnnGetOnlineStateById(const char *id, IdCategory type) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen) = 0;
|
||||
virtual int32_t LnnAsyncCallbackDelayHelper(SoftBusLooper *looper, LnnAsyncCallbackFunc callback,
|
||||
void *para, uint64_t delayMillis) = 0;
|
||||
@ -71,7 +73,7 @@ public:
|
||||
MOCK_METHOD1(LnnUpdateOhosAccount, void (bool));
|
||||
MOCK_METHOD0(LnnOnOhosAccountLogout, void (void));
|
||||
MOCK_METHOD2(LnnGetOnlineStateById, bool(const char *, IdCategory));
|
||||
MOCK_METHOD2(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, bool));
|
||||
MOCK_METHOD3(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, const LnnDfxDeviceInfoReport *, bool));
|
||||
MOCK_METHOD2(LnnRequestLeaveByAddrType, int32_t (const bool *, uint32_t));
|
||||
MOCK_METHOD4(LnnAsyncCallbackDelayHelper, int32_t (SoftBusLooper *, LnnAsyncCallbackFunc, void *, uint64_t));
|
||||
MOCK_METHOD2(LnnRegisterEventHandler, int32_t (LnnEventType, LnnEventHandler));
|
||||
|
@ -821,7 +821,9 @@ HWTEST_F(HeartBeatMediumTest, HbUpdateOfflineTimingByRecvInfo_TEST01, TestSize.L
|
||||
HWTEST_F(HeartBeatMediumTest, SoftBusNetNodeResult_TEST01, TestSize.Level1)
|
||||
{
|
||||
DeviceInfo device;
|
||||
HbRespData hbResp;
|
||||
(void)memset_s(&device, sizeof(DeviceInfo), 0, sizeof(DeviceInfo));
|
||||
(void)memset_s(&hbResp, sizeof(HbRespData), 0, sizeof(HbRespData));
|
||||
NiceMock<HeartBeatStategyInterfaceMock> heartBeatMock;
|
||||
NiceMock<LnnNetLedgertInterfaceMock> ledgerMock;
|
||||
EXPECT_CALL(heartBeatMock, LnnNotifyDiscoveryDevice)
|
||||
@ -829,11 +831,11 @@ HWTEST_F(HeartBeatMediumTest, SoftBusNetNodeResult_TEST01, TestSize.Level1)
|
||||
.WillRepeatedly(Return(SOFTBUS_OK));
|
||||
EXPECT_CALL(heartBeatMock, IsExistLnnDfxNodeByUdidHash).WillRepeatedly(Return(true));
|
||||
EXPECT_CALL(ledgerMock, LnnGetLocalByteInfo).WillOnce(Return(SOFTBUS_ERR));
|
||||
int32_t ret = SoftBusNetNodeResult(&device, false);
|
||||
int32_t ret = SoftBusNetNodeResult(&device, &hbResp, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_ERR);
|
||||
ret = SoftBusNetNodeResult(&device, false);
|
||||
ret = SoftBusNetNodeResult(&device, &hbResp, false);
|
||||
EXPECT_TRUE(ret == SOFTBUS_NETWORK_NODE_DIRECT_ONLINE);
|
||||
ret = SoftBusNetNodeResult(&device, true);
|
||||
ret = SoftBusNetNodeResult(&device, &hbResp, true);
|
||||
EXPECT_TRUE(ret == SOFTBUS_NETWORK_HEARTBEAT_UNTRUSTED);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,8 @@ public:
|
||||
|
||||
virtual int32_t LnnStartOfflineTimingStrategy(const char *networkId, ConnectionAddrType addrType) = 0;
|
||||
virtual int32_t LnnStopOfflineTimingStrategy(const char *networkId, ConnectionAddrType addrType) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnSetHbAsMasterNodeState(bool isMasterNode) = 0;
|
||||
virtual int32_t LnnNotifyMasterElect(const char *networkId, const char *masterUdid, int32_t masterWeight) = 0;
|
||||
virtual void LnnNotifyHBRepeat(void);
|
||||
@ -67,7 +68,7 @@ public:
|
||||
|
||||
MOCK_METHOD2(LnnStartOfflineTimingStrategy, int32_t(const char *, ConnectionAddrType));
|
||||
MOCK_METHOD2(LnnStopOfflineTimingStrategy, int32_t(const char *, ConnectionAddrType));
|
||||
MOCK_METHOD2(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, bool));
|
||||
MOCK_METHOD3(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, const LnnDfxDeviceInfoReport *, bool));
|
||||
MOCK_METHOD3(LnnNotifyMasterElect, int32_t(const char *, const char *, int32_t));
|
||||
MOCK_METHOD1(LnnSetHbAsMasterNodeState, int32_t(bool));
|
||||
MOCK_METHOD0(LnnNotifyHBRepeat, void ());
|
||||
|
@ -32,7 +32,8 @@ public:
|
||||
|
||||
virtual int32_t LnnStartOfflineTimingStrategy(const char *networkId, ConnectionAddrType addrType) = 0;
|
||||
virtual int32_t LnnStopOfflineTimingStrategy(const char *networkId, ConnectionAddrType addrType) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect) = 0;
|
||||
virtual int32_t LnnSetHbAsMasterNodeState(bool isMasterNode) = 0;
|
||||
virtual int32_t LnnNotifyMasterElect(const char *networkId, const char *masterUdid, int32_t masterWeight) = 0;
|
||||
virtual int32_t LnnStartHbByTypeAndStrategy(
|
||||
@ -63,7 +64,7 @@ public:
|
||||
|
||||
MOCK_METHOD2(LnnStartOfflineTimingStrategy, int32_t(const char *, ConnectionAddrType));
|
||||
MOCK_METHOD2(LnnStopOfflineTimingStrategy, int32_t(const char *, ConnectionAddrType));
|
||||
MOCK_METHOD2(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, bool));
|
||||
MOCK_METHOD3(LnnNotifyDiscoveryDevice, int32_t(const ConnectionAddr *, const LnnDfxDeviceInfoReport *, bool));
|
||||
MOCK_METHOD3(LnnNotifyMasterElect, int32_t(const char *, const char *, int32_t));
|
||||
MOCK_METHOD1(LnnSetHbAsMasterNodeState, int32_t(bool));
|
||||
MOCK_METHOD3(LnnStartHbByTypeAndStrategy, int32_t (LnnHeartbeatType, LnnHeartbeatStrategyType, bool));
|
||||
|
@ -47,9 +47,10 @@ int32_t LnnStopOfflineTimingStrategy(const char *networkId, ConnectionAddrType a
|
||||
return HeartBeatFSMInterfaceInstance()->LnnStopOfflineTimingStrategy(networkId, addrType);
|
||||
}
|
||||
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect)
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect)
|
||||
{
|
||||
return HeartBeatFSMInterfaceInstance()->LnnNotifyDiscoveryDevice(addr, isNeedConnect);
|
||||
return HeartBeatFSMInterfaceInstance()->LnnNotifyDiscoveryDevice(addr, infoReport, isNeedConnect);
|
||||
}
|
||||
|
||||
int32_t LnnNotifyMasterElect(const char *networkId, const char *masterUdid, int32_t masterWeight)
|
||||
|
@ -47,9 +47,10 @@ int32_t LnnStopOfflineTimingStrategy(const char *networkId, ConnectionAddrType a
|
||||
return HeartBeatStrategyInterface()->LnnStopOfflineTimingStrategy(networkId, addrType);
|
||||
}
|
||||
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, bool isNeedConnect)
|
||||
int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr, const LnnDfxDeviceInfoReport *infoReport,
|
||||
bool isNeedConnect)
|
||||
{
|
||||
return HeartBeatStrategyInterface()->LnnNotifyDiscoveryDevice(addr, isNeedConnect);
|
||||
return HeartBeatStrategyInterface()->LnnNotifyDiscoveryDevice(addr, infoReport, isNeedConnect);
|
||||
}
|
||||
|
||||
int32_t LnnNotifyMasterElect(const char *networkId, const char *masterUdid, int32_t masterWeight)
|
||||
|
Loading…
Reference in New Issue
Block a user