harmony 鸿蒙NetConn_NetConnCallback

2025-06-12 浏览 (2)

NetConn_NetConnCallback

Overview

Defines network status callbacks.

Since: 12

Related module: NetConnection

Header file: net_connection_type.h

Summary

Member Variables

NameDescription
onNetworkAvailableCalled when the network is available.
onNetCapabilitiesChangeCalled when the network capabilities change.
onConnetionPropertiesCalled when network connection properties change.
onNetLostCalled when the network is disconnected.
onNetUnavailableCalled when the network is unavailable. This callback is triggered when the network is not activated within the specified timeout interval. If the timeout interval is not set, this callback is not triggered.

Member Variable Description

onNetworkAvailable

typedef void (*OH_NetConn_NetworkAvailable)(NetConn_NetHandle *netHandle)

Description

Called when the network is available.

Description

After the callback is complete, the parameter memory is automatically cleared and therefore the parameter pointer should be released.

Parameters

NameTypeDescription
netHandleNetHandleNetwork handle.

onNetCapabilitiesChange

typedef void (*OH_NetConn_NetCapabilitiesChange)(NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapabilities)

Description

Called when the network capabilities change.

Description

After the callback is complete, the parameter memory is automatically cleared and therefore the parameter pointer should be released.

Parameters

NameTypeDescription
netHandleNetHandleNetwork handle.
netCapabilitiesNetCapabilitiesNetwork capabilities.

onConnetionProperties

typedef void (*OH_NetConn_NetConnectionPropertiesChange)(NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *connConnetionProperties)

Description

Called when network connection properties change.

Description

After the callback is complete, the parameter memory is automatically cleared and therefore the parameter pointer should be released.

Parameters

NameTypeDescription
netHandleNetHandleNetwork handle.
connConnetionPropertiesConnectionPropertiesNetwork connection properties.

onNetLost

typedef void (*OH_NetConn_NetLost)(NetConn_NetHandle *netHandle)

Description

Called when the network is disconnected.

Description

After the callback is complete, the parameter memory is automatically cleared and therefore the parameter pointer should be released.

Parameters

NameTypeDescription
netHandleNetHandleNetwork handle.

onNetUnavailable

typedef void (*OH_NetConn_NetUnavailable)(void)

Description

Called when the network is unavailable. This callback is triggered when the network is not activated within the specified timeout interval. If the timeout interval is not set, this callback is not triggered.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Network Kit

harmony 鸿蒙NetConn_ConnectionProperties

harmony 鸿蒙NetConn_HttpProxy

harmony 鸿蒙NetConn_NetAddr

harmony 鸿蒙NetConn_NetCapabilities

harmony 鸿蒙NetConn_NetHandle

harmony 鸿蒙NetConn_NetHandleList

harmony 鸿蒙NetConn_NetSpecifier

harmony 鸿蒙NetConn_Route

harmony 鸿蒙NetConnection

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/leugpk