Heartbeat cycle adjustment method, device, and system

By dynamically adjusting the heartbeat cycle of IoT devices, the problems of poor user experience and high power consumption caused by fixed heartbeat cycles are solved, achieving more efficient IoT device management and platform performance optimization.

CN117527652BActive Publication Date: 2026-02-13HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210900476.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-28
Publication Date
2026-02-13
Estimated Expiration
2042-07-28

AI Technical Summary

Technical Problem

The fixed heartbeat cycle of IoT devices makes it difficult for users to quickly perceive the device status or increases power consumption and platform performance pressure.

Method used

By combining multiple factors to dynamically adjust the heartbeat cycle of IoT devices, such as the IoT device registration time and active data, the heartbeat cycle can be dynamically adjusted to optimize user experience and reduce power consumption.

Benefits of technology

It enables more accurate heartbeat cycle adjustment under different users and time periods, reduces the power consumption of IoT devices, alleviates the performance pressure on the IoT platform, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117527652B_ABST
    Figure CN117527652B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a heartbeat period adjustment method, device and system, and relate to the technical field of Internet of Things. In the present application, an IoT platform dynamically adjusts a heartbeat period of an IoT device according to factors such as a registration time of the IoT device, an offline time of the IoT device, and a time at which a user device controls the IoT device. When the probability of the user using the IoT device is low, the heartbeat period is extended, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform. When the probability of the user using the IoT device is high, the heartbeat period is shortened, thereby maximizing the consistency between the online state of the IoT device and the database record, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet of Things (IoT), and in particular to a heartbeat period adjustment method, device and system. BACKGROUND

[0002] An IoT platform plays a role of connecting the upstream and downstream in the IoT industry chain, and mainly provides services such as connecting hardware, processing different communication protocols, providing security and identity verification for devices and users, collecting data and performing visual analysis, and integrating with other Web services.

[0003] In the field of smart home and the like, a user device, an IoT platform and an IoT device implement remote control through a long connection protocol such as message queuing telemetry transport (MQTT). For example, the IoT device maintains a transmission control protocol (TCP) long connection through a ping / pong mechanism, the IoT platform senses whether the TCP long connection is disconnected through the ping and stores the state of the IoT device, so that the user device can query the state of the IoT device from the IoT platform.

[0004] However, the heartbeat period of most IoT devices is fixed. If the heartbeat period of the IoT device is too long, the user cannot quickly and truly perceive the state of the IoT device when using the user device; if the heartbeat period of the IoT device is too short, the power consumption of the IoT device and the performance pressure of the IoT platform are increased. How to optimize the heartbeat period of the IoT device becomes a problem to be solved. SUMMARY

[0005] The present application provides a heartbeat period adjustment method, device and system, which can dynamically adjust the heartbeat period of an IoT device in combination with various factors, thereby reducing the power consumption of the IoT device, alleviating the performance pressure of the IoT platform and improving the user experience.

[0006] To achieve the above object, the present application adopts the following technical solutions:

[0007] In a first aspect, an embodiment of the present application provides a heartbeat period adjustment method. The method is applied to an IoT platform and includes:

[0008] When the system time of the IoT platform reaches the start time of the i th execution cycle of the heartbeat period adjustment task, a basic heartbeat period corresponding to the i th execution cycle is determined according to the time when the IoT device is registered to the IoT platform, i being a positive integer.

[0009] adjust the base heartbeat period corresponding to the i th execution cycle according to the active data of the target period in the i-1 th execution cycle, to obtain a heartbeat period of the target period in the i th execution cycle, the target period being any one of the M periods included in the i-1 th execution cycle and the i th execution cycle respectively, the active data being used to represent the activity degree of the IoT device in the target period of the i-1 th execution cycle, and M being a positive integer;

[0010] send an instruction to the IoT device, the instruction including the heartbeat period of each period in the i th execution cycle, the heartbeat period of each period in the i th execution cycle being used to instruct the IoT device to send a heartbeat packet to the IoT platform in each period.

[0011] It should be noted that the heartbeat period adjustment task is to calculate the heartbeat period of the IoT device once in each of the multiple execution cycles, taking the time when the IoT device is registered to the IoT platform as the starting time. The i th execution cycle is any one of the execution cycles of the heartbeat period adjustment task.

[0012] In the present scheme, each execution cycle corresponds to a preset base heartbeat period. Since there are individual differences among different users, and there may also be differences in different periods of an execution cycle for the same user, if all users send heartbeat packets in different periods using the same base heartbeat period, there may be problems such as some users cannot quickly and truly perceive the state of the IoT device through the user device, or the power consumption of some IoT devices is high. Therefore, after determining the base heartbeat period corresponding to an execution cycle, the base heartbeat period can be dynamically adjusted according to the active data of each period in the last execution cycle, so as to more accurately calculate the final heartbeat period corresponding to each period of the present execution cycle. For example, when the probability of the user using the IoT device is low, the heartbeat period is prolonged, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform; when the probability of the user using the IoT device is high, the heartbeat period is shortened, thereby maximizing the consistency between the online state of the IoT device and the database record, and improving the user experience.

[0013] In a possible implementation, the base heartbeat period corresponding to the i-1 th execution cycle is less than or equal to the base heartbeat period corresponding to the i th execution cycle.

[0014] It should be understood that when a user newly purchases an IoT device, the user has a strong sense of novelty for the IoT device, and the user device is used to remotely control the IoT device more frequently. In this case, the basic heartbeat period corresponding to one execution period can be set to be shorter, so as to increase the number of heartbeat periods, thereby enabling the user to quickly perceive the real status of the IoT device through the user device. After a period of time, as the user's sense of novelty for the IoT device weakens, the user device is used to remotely control the IoT device less frequently. In this case, the basic heartbeat period corresponding to one execution period can be set to be longer, so as to reduce the number of heartbeat periods, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform.

[0015] In a possible implementation, the i-1th execution period and the i th execution period each include N sub-periods. Each of the N sub-periods includes M sub-intervals. The target interval is the j th interval of the M intervals. The j th interval includes the j th sub-interval of each sub-period. Wherein, N is a positive integer, and j is a positive integer less than or equal to M.

[0016] Exemplarily, one execution period is one month, one sub-period is one day, and one sub-interval is 0.5 hours, 1 hour, or 2 hours. The target interval can include 12:00-13:59 of the 1st day, 12:00-13:59 of the 2nd day,..., and 12:00-13:59 of the 30th day.

[0017] In a possible implementation, the active data is a user activity index. Before adjusting the basic heartbeat period corresponding to the i th execution period according to the active data of the target interval in the i-1th execution period, the method further includes:

[0018] obtaining a number of target events occurring in the target interval of the i-1th execution period, the target event being an event associated with the IoT device; and obtaining, according to the number of target events, a user activity index of the target interval in the i-1th execution period, the user activity index being in a positive proportional relationship with the number of target events.

[0019] In a possible implementation, the target event includes at least one of the following:

[0020] a first event, the first event being an event in which the user device controls the IoT device through the IoT platform;

[0021] a second event, the second event being an event in which an IoT application of the user device switches to a foreground running state, the IoT application being used to control the IoT device;

[0022] The third event is an event of the IoT device reporting collected data to the IoT platform.

[0023] The fourth event is an offline event of the IoT device.

[0024] In a possible implementation, the target event includes the first event, the second event, the third event and the fourth event, and each type of event corresponds to a user activity index. Accordingly, the user activity index of the target period in the i-1th execution cycle is obtained according to the number of times of occurrence of the target event, and includes:

[0025] The first user activity index is obtained according to the number of times of occurrence of the first event in the target period of the i-1th execution cycle, the second user activity index is obtained according to the number of times of occurrence of the second event in the target period of the i-1th execution cycle, the third user activity index is obtained according to the number of times of occurrence of the third event in the target period of the i-1th execution cycle, and the fourth user activity index is obtained according to the number of times of occurrence of the fourth event in the target period of the i-1th execution cycle.

[0026] It should be understood that the activity level of the IoT device in the previous execution cycle is strongly related to the activity level of the IoT device in the current execution cycle. According to the activity level of the IoT device in the previous execution cycle, the probability of the user using the IoT device in the current execution cycle can be preset, and the heartbeat period corresponding thereto is set.

[0027] In a possible implementation, the heartbeat period in the target period of the i-1th execution cycle is adjusted according to the active data in the target period of the i-1th execution cycle, to obtain the heartbeat period in the target period of the i-1th execution cycle, and includes:

[0028] According to the first user activity index, the second user activity index, the third user activity index and the fourth user activity index, the heartbeat period T2 in the target period of the i-1th execution cycle is calculated by using the following equation:

[0029]

[0030] Wherein, T1 represents the basic heartbeat period corresponding to the i-1th execution cycle, i1 represents the first user activity index, i2 represents the second user activity index, i3 represents the third user activity index, i4 represents the fourth user activity index, F1 represents the weight coefficient corresponding to the first event, F2 represents the weight coefficient corresponding to the second event, F3 represents the weight coefficient corresponding to the third event, and F4 represents the weight coefficient corresponding to the fourth event.

[0031] In a possible implementation, the method further includes:

[0032] In the i-1th execution cycle, first data and second data from the user equipment are received, the first data indicating a first event, and the second data indicating a second event; in the i-1th execution cycle, third data and fourth data from the IoT device are received, the third data indicating a third event, and the fourth data indicating a fourth event.

[0033] In a possible implementation, the i-1th execution cycle includes N sub-cycles, and each of the N sub-cycles includes M sub-periods; the target period is the jth period of the M periods, and the jth period includes the jth sub-period of each sub-cycle. N is a positive integer, and j is a positive integer less than or equal to M.

[0034] Correspondingly, the number of times of occurrence of the target event in the target period of the i-1th execution cycle is obtained, including:

[0035] For each type of event of the target event, if the number of times of occurrence of each type of event in the jth sub-period of any one sub-cycle of the i-1th execution cycle is greater than or equal to 1, 1 is marked; the number of times of marking in the jth sub-period of the N sub-cycles of the i-1th execution cycle is summed up to obtain the number of times of occurrence of each type of event in the target period of the i-1th execution cycle.

[0036] In a possible implementation, before determining that the system time of the IoT platform reaches the start time of the i th execution cycle of the heartbeat period adjustment task, the method further includes:

[0037] A registration request message from the IoT device is received; in response to the registration request message, it is verified that the IoT device is a legal device; the heartbeat period adjustment task is created, and a successful registration message is sent to the IoT device.

[0038] In a possible implementation, the length of each execution cycle is determined according to at least one of the following: the device type of the IoT device, and the number of devices registered to the IoT platform.

[0039] It should be understood that for the IoT device that is frequently remotely operated by the user, the execution cycle of the heartbeat period adjustment task can be set to be shorter, so as to increase the number of times of calculating the heartbeat period, thereby timely adjusting the heartbeat period. In addition, when the number of IoT devices registered to the IoT platform is smaller, the performance pressure of the IoT platform is smaller, and the execution cycle of the heartbeat period adjustment task can be set to be shorter, so as to increase the number of times of calculating the heartbeat period, thereby being able to more accurately estimate the heartbeat period of the IoT device. As the number of IoT devices registered to the IoT platform increases, the performance pressure of the IoT platform is greater, and at this time, the execution cycle of the heartbeat period adjustment task can be set to be longer, so as to reduce the number of times of calculating the heartbeat period, thereby reducing the performance pressure of the IoT platform.

[0040] In a possible implementation, after sending the instruction to the IoT device, the method further includes:

[0041] If the heartbeat packet from the IoT device is received within a preset time, it is determined that the IoT device is in an online state, and a heartbeat response is sent to the IoT device. Alternatively, if the heartbeat packet from the IoT device is not received within the preset time, it is determined that the IoT device is in an offline state, and the connection between the IoT platform and the IoT device is released. The heartbeat packet and the heartbeat response are used to maintain the long connection between the IoT device and the IoT platform.

[0042] In a second aspect, an embodiment of the present application provides a heartbeat period adjustment method. The method is applied to an IoT device and includes:

[0043] receiving an instruction from an IoT platform, the instruction including a heartbeat period of each time period in an i th execution cycle of a heartbeat period adjustment task; and in each time period in the i th execution cycle, sending a heartbeat packet to the IoT platform according to the heartbeat period of each time period. Wherein i is a positive integer.

[0044] It should be understood that when the IoT platform accurately predicts the heartbeat period of each time period in the current execution cycle, the IoT device can dynamically adjust the heartbeat period in each time period and send a heartbeat packet according to the adjusted heartbeat period to maintain the long connection.

[0045] In a possible implementation, if a heartbeat response from the IoT platform is received within a preset time, it is determined that the long connection between the IoT device and the IoT platform is valid.

[0046] In a possible implementation, if a heartbeat response from the IoT platform is not received within a preset time, it is determined that the long connection between the IoT device and the IoT platform is invalid.

[0047] In a possible implementation, before receiving the instruction from the IoT platform, the method further includes:

[0048] in an (i-1) th execution cycle, sending third data and fourth data to the IoT platform. The third data indicates a third event, and the fourth data indicates a fourth event. The third event is an event in which the IoT device reports collected data to the IoT platform, and the fourth event is an offline event of the IoT device. The third event and the fourth event are used to calculate the heartbeat period of each time period in the i th execution cycle.

[0049] In a third aspect, an embodiment of the present application provides an IoT platform, comprising a communication interface, a processor and a memory. The communication interface is configured to connect with an IoT device and a user device. The processor is coupled with the memory. The processor is configured to execute computer programs or instructions stored in the memory, so that the IoT platform implements the heartbeat period adjustment method according to any one of the first aspect.

[0050] In a fourth aspect, an embodiment of the present application provides an IoT device, comprising a communication interface, a processor and a memory. The communication interface is configured to connect with an IoT platform. The processor is coupled with the memory. The processor is configured to execute computer programs or instructions stored in the memory, so that the IoT device implements the heartbeat period adjustment method according to any one of the second aspect.

[0051] In a fifth aspect, the present application provides a heartbeat period adjustment apparatus, which comprises units / modules for executing the method according to the first aspect or the second aspect. The apparatus can correspond to the method described in the first aspect or the second aspect. The units / modules in the apparatus are described in the first aspect or the second aspect. For brevity, the description is not repeated here.

[0052] In a sixth aspect, a chip is provided, which is coupled with a memory. The chip is configured to read and execute computer programs stored in the memory, so as to implement the heartbeat period adjustment method according to any one of the first aspect or the second aspect.

[0053] In a seventh aspect, a computer readable storage medium is provided, which stores a computer program. When the computer program is run on an IoT platform, the electronic device executes the heartbeat period adjustment method according to any one of the first aspect. When the computer program is run on an IoT device, the IoT device executes the heartbeat period adjustment method according to any one of the second aspect.

[0054] In an eighth aspect, a computer program product is provided, which, when run on a computer, causes the computer to execute the heartbeat period adjustment method according to any one of the first aspect or the second aspect.

[0055] It can be understood that the beneficial effects of the third aspect to the eighth aspect can be understood by referring to the description of the first aspect and the second aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 A schematic diagram of a heartbeat synchronization process between a client and a server provided by an embodiment of the present application;

[0057] Figure 2 An architecture schematic diagram of an IoT system provided by an embodiment of the present application;

[0058] Figure 3 A software structure diagram of an IoT platform provided for an embodiment of the present application;

[0059] Figure 4 A flow diagram of a heartbeat period adjustment method provided for an embodiment of the present application;

[0060] Figure 5 A diagram of heartbeat periods in the same period of different execution periods provided for an embodiment of the present application;

[0061] Figure 6 A flow diagram of an IoT device maintaining a long connection provided for an embodiment of the present application;

[0062] Figure 7 A diagram of a heartbeat synchronization process of an IoT device and an IoT platform in three periods provided for an embodiment of the present application;

[0063] Figure 8 A diagram of an operation interface of a user device provided for an embodiment of the present application;

[0064] Figure 9 An exemplary block diagram of an apparatus provided for an embodiment of the present application;

[0065] Figure 10 A structure diagram of an IoT platform provided for an embodiment of the present application. DETAILED DESCRIPTION

[0066] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application.

[0067] In the description of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B. In the description of the present application, "and / or" is only a description of the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can mean that A exists alone, A and B exist together, and B exists alone.

[0068] In the description and claims of the present application, the terms "first" and "second" and the like are used to distinguish different objects or to distinguish different treatments of the same object, and are not used to describe a specific order of the object. For example, first data and second data are used to distinguish different data, and are not used to describe a specific order of the data. In the embodiments of the present application, "a plurality of" means two or more.

[0069] Reference to "one embodiment" or "some embodiments" or "one implementation" or "some implementations" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearance of the phrases in various places in the specification is not therefore necessarily referring to the same embodiment(s) or the same place of disclosure. The terms "including," "comprising," "having," and the like are meant to be open-ended terms that specifically permit the specification of the listed item(s) and do not exclude additional, unrecited item(s). None of the use of such terms in the description should be interpreted to exclude additional, unrecited item(s) or additional, unrecited process steps.

[0070] Some terms or phrases used in the present application are explained first.

[0071] (1) Long connection

[0072] When network communication adopts TCP protocol, the server and the client perform three handshakes to establish TCP connection. After the data or signaling transmission between the two parties is completed, the server and the client perform four handshakes to release the TCP connection. When the server and the client have data or signaling transmission needs next time, the TCP connection is re-established, and then the TCP connection is released again. This connection mode is called short connection. For example, the hypertext transfer protocol (HTTP) service of a Web site generally adopts short connection to save server resources.

[0073] The establishment and release stages of TCP connection are relatively complex. If the client frequently requests the server to establish TCP, and then frequently disconnects the TCP connection, it will waste a certain amount of time and increase system overhead. In order to save time and reduce system overhead, the server and the client can maintain a long connection. That is, after the two parties establish a connection based on TCP protocol, they communicate, and after the communication is completed, they do not actively disconnect the connection, but continue to maintain the TCP connection. In this way, when the next data packet needs to be transmitted, the server and the client can directly transmit the data packet through the long connection.

[0074] (2) Heartbeat mechanism

[0075] When the service end and the client maintain the long connection, if the service end and the client do not transmit data or signaling for a long time, in order to save network resources, the service end will disconnect the long connection between the service end and the client, and allocate more network resources to other devices with transmission requirements. For example, if the service end and the client do not transmit data or signaling within 10 minutes, the service end will disconnect the long connection. Usually, the service end and the client will adopt a heartbeat mechanism to keep the long connection as much as possible, so as to ensure that the service end always determines that the long connection is in an active state, and avoid disconnection of the long connection.

[0076] The principle of the heartbeat mechanism is that the client sends a heartbeat packet to the service end every time interval, and the service end returns a heartbeat response to the client in response to the heartbeat packet after receiving the heartbeat packet, so as to form a complete handshake process of the client and the service end. Through the handshake process, the client and the service end both determine that the TCP connection is not disconnected, and the client is still online. If the time threshold is exceeded, the service end does not receive the heartbeat packet of the client, and then the service end disconnects the TCP connection. Alternatively, if the time threshold is exceeded, the client does not receive the heartbeat response of the service end, and then the client disconnects the TCP connection with the server and reestablishes the TCP connection.

[0077] Exemplarily, Figure 1 A schematic diagram of a heartbeat synchronization process of the client and the service end is shown. After the client and the service end establish the TCP connection, in each heartbeat period, the client sends a Ping frame to the service end, and the Ping frame can carry data customized by the client. After receiving the Ping frame, the service end returns a Pong frame to the client in response to the Ping frame, and the Pong frame carries the same data as the Ping frame. The Ping frame and the Pong frame are heartbeats in the protocol, which are used to detect whether the client is online and ensure the survival of the long connection.

[0078] It should be noted that in the embodiments of the present application, the client can be an IoT device, and the service end can be an IoT platform.

[0079] Currently, IoT involves smart home, smart medical care, smart transportation and smart metering and other fields. In these fields, IoT platforms and IoT devices can achieve remote control through a long connection protocol. For example, an IoT device maintains a TCP long connection through a heartbeat mechanism, and an IoT platform senses whether the TCP long connection is disconnected through the heartbeat and stores the state of the IoT device. However, the heartbeat period of most IoT devices is fixed, such as the heartbeat period of an IoT device in the smart home field is usually 60 seconds. If the heartbeat period of the IoT device is too long, the user cannot quickly perceive the real state of the IoT device when using the user device, for example, the user device obtains from the IoT platform that the IoT device is in an online state, while the real state of the IoT device is an offline state. At this time, if the user attempts to remotely control the IoT device through the user device, the IoT device does not respond for a long time, thereby reducing the operation experience of the user. If the heartbeat period of the IoT device is too short, the power consumption of the IoT device and the performance pressure of the IoT platform are increased.

[0080] In view of the above problems, the embodiment of the present application provides a heartbeat period adjustment method: an IoT platform dynamically adjusts the heartbeat period of an IoT device according to the registration time of the IoT device, the offline time of the IoT device, the time when a user device controls the IoT device and other factors. When the probability of the user using the IoT device is low, the heartbeat period is extended, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform. When the probability of the user using the IoT device is high, the heartbeat period is shortened, thereby maximizing the consistency between the online state of the IoT device and the database record, and improving the user experience.

[0081] It should be noted that the heartbeat period adjustment method provided by the embodiment of the present application is applicable to various IoT systems, such as smart home systems, smart medical care systems, smart transportation systems and smart metering systems. In the following, the smart home system will be taken as an example for detailed description, which does not constitute a limitation on the technical solutions provided by the embodiment of the present application. Those skilled in the art can know that with the appearance of new business scenarios, the technical solutions provided by the embodiment of the present application are also applicable to similar technical problems.

[0082] Figure 2 The architecture of an IoT system provided by the embodiment of the present application is shown in the figure. Figure 2 As shown in the figure, the system includes a user device, an IoT device, an IoT platform and a database (DB).

[0083] The user device is connected with the IoT platform through a network 1, and the IoT device is connected with the IoT platform through a network 2.

[0084] The network 1 and the network 2 can be a local area network (LAN) or a wide area network (WAN), such as the Internet. The network 1 and the network 2 can be implemented using any known network communication protocol. The network communication protocol can be various wired or wireless communication protocols, such as Ethernet, universal serial bus (USB), firewire, global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), worldwide interoperability for microwave access (WiMAX), 5th Generation (5G) communication (such as new radio access technology (NR)), Bluetooth, wireless fidelity (Wi-Fi), voice over Internet Protocol (VoIP), or any other suitable communication protocol.

[0085] The user device is a master device of the IoT system, and is configured to perform interactive operations such as remote monitoring of the IoT device, modification of the IoT device information, addition of the IoT device, deletion of the IoT device, and the like through the IoT platform. In some embodiments, the user device can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) device, a virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a smart screen, or the like, or can be another device or apparatus capable of remote control. The specific type of the user device is not limited in the embodiments of the present application.

[0086] The IoT device is configured to collect various information such as sound, light, heat, electricity, mechanics, chemistry, biology, and position, and the like, to achieve intelligent perception, identification, and management of an environment, an object, or a process. In some embodiments, the IoT device can be a smart home device related to home life, such as a smart speaker, a router, a projector, a temperature and humidity meter, a smart television, a smart screen, an air purifier, a lamp, a refrigerator, a washing machine, a microwave oven, a smoke alarm, a natural gas alarm, a hair dryer, a smart door lock, a camera, an air conditioner, and the like, which adopts wiring technology, network communication technology, security and protection technology, automatic control technology, or audio and video technology.

[0087] An IoT platform is an Internet-based, multi-communication technology built middle platform in the Internet of Things. The IoT platform can be used to provide the following services: connecting hardware, processing different communication protocols, providing security and authentication for devices and users, collecting data and visualizing analysis, and integrating with other web services. Generally, the IoT platform includes an application enablement platform (AEP), a device management platform (DMP), a connectivity management platform (CMP), and an IoT agent. Among them, the AEP is mainly responsible for business orchestration, big data analysis, industry kits, and application programming interface (API) management, etc. The DMP is mainly responsible for device authentication, data collection, Internet of Things protocol adaptation, subscription notification, firmware upgrade, and alarm management, etc. The CMP is mainly responsible for enabling subscriber identity module (SIM) card access to operator networks, and interfacing with operator billing systems, etc. The IoT agent is mainly responsible for accessing the pre-integrated device platform, and implementing near-field control and edge computing, etc. In some examples, the IoT platform can be a cloud platform, or a cloud server, or a network-side server. In yet other examples, the IoT platform can be an edge gateway or an edge node deployed at the edge side.

[0088] A database is a large collection of organized, shareable, and uniformly managed data stored in a computer according to a data structure. The database can store online / offline status of IoT devices, registration time of IoT devices, and data collected by IoT devices, etc. In some examples, if the IoT platform is a cloud platform or a cloud server, the database can be stored in the IoT platform. In yet other examples, the database can also be stored in other computer devices other than the IoT platform.

[0089] It should be noted that, Figure 2Only part of the devices of the IoT system are shown. It should be understood that the IoT system can also include more devices when actually implemented. For example, when a plurality of IoT devices are connected to each other through Bluetooth, the IoT system can also include a provisioner, which can also be referred to as a Bluetooth gateway, for performing network provisioning on the plurality of IoT devices, adding the plurality of IoT devices to a Bluetooth mesh network, and enabling the plurality of IoT devices to become nodes in the Bluetooth mesh network. For another example, the IoT system can also include an application server, a high-availability load balancing server, a cloud gateway server, a relay device, and the like connected to the IoT platform, which are not limited by embodiments of the present application.

[0090] Figure 3 A software structure diagram of the IoT platform provided by embodiments of the present application is shown. The IoT platform adopts a layered architecture, and divides the software into a plurality of layers, each of which has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software layers of the software structure are divided from top to bottom as follows: an application layer, a business enabling layer, a device connection layer, an access layer, and a terminal layer.

[0091] The application layer can include a series of application (APP) packages, such as smart home, smart medical care, smart transportation, smart meter reading, and third-party application programs, etc. When these application programs are run, each service module provided by the business enabling layer can be accessed through an application programming interface (API), and corresponding IoT businesses can be executed.

[0092] The business enabling layer mainly provides APP&API open management, data management and opening, a rule engine, and the like. The APP&API open management provides API search, API help, and the like, and a unified API life cycle management service. The data management and opening converts native data of devices according to a model, and performs commercial behavior definition through a rule engine and a business arrangement module. The rule engine uses a terminal user as an object, and defines a rule scenario that is already pre-provisioned by the system.

[0093] The device connection layer comprises a device management module, a timing task module, a data analysis module, a heartbeat period adjustment module, a state management module, a transmission protocol adaptation module and a lightweight authentication module. The device management module is used for IoT device registration and information management of the IoT device, such as managing the type of the IoT device, the registration time of the IoT device, the collected data or alarm data reported by the IoT device, etc. The timing task module is used to create a heartbeat period adjustment task for each IoT device. The data analysis module is used to count the active data of the user using the IoT device in each period of each cycle, and to predict the active probability of using the IoT device in each period of the next cycle. The heartbeat period adjustment module is used to calculate the heartbeat period of the IoT device in each period according to the registration time of the IoT device, the offline time of the IoT device, the time of the user device controlling the IoT device and other factors, and to issue the calculated heartbeat period to the IoT device. The state management module is used to manage the online / offline state of the IoT device. The transmission protocol adaptation module supports interface protocols including HTTP and MQTT, etc. The lightweight authentication module is used for authentication and authorization of devices and application programs. It should be noted that each module in the device connection layer is only an example, and in actual implementation, one module can be split into multiple modules, and multiple modules can be combined into one module, such as the device management module and the state management module can be the same module.

[0094] The access layer supports various access methods such as wireless, fixed access, etc., and adapts sensors of different manufacturers through the IoT agent. Network access can be mobile broadband access, fixed broadband access and IoT access, etc.

[0095] The terminal layer comprises an IoT agent, which is used to adapt the operating system and intelligent terminals and intelligent hardware of various manufacturers. The intelligent terminal can be a smart phone, an IPAD or a computer, etc. The intelligent hardware can be a radio frequency identification device, a sensor based on photoacoustic electromagnetic, a laser scanner and various devices.

[0096] The following takes the device management module, the timing task module, the data analysis module, the heartbeat period adjustment module and the state management module in the IoT platform as shown in Figure 3 The heartbeat period adjustment method provided by the embodiments of the present application is exemplarily illustrated. Exemplarily, as shown in Figure 4 The method can comprise: stage one, creating a heartbeat period adjustment task, stage two, data statistics, stage three, calculating a heartbeat period, and stage four, recording and querying the state of the IoT device.

[0097] Stage one, creating a heartbeat period adjustment task

[0098] The IoT device and the IoT platform create a heartbeat period adjustment task through S1-S6 as follows.

[0099] S1. The IoT device sends a registration request message to the device management module.

[0100] The registration request message is used to request registration of the IoT device to the IoT platform.

[0101] Exemplarily, the registration request message includes device identification information of the IoT device, such as a device model, a personal identification number (PIN), and / or a media access control (MAC) address, etc., which are used to identify the IoT device. The device model is used to identify the IoT device, and the IoT device is usually named by the device model, and the device icon corresponding to the IoT device is determined according to the device model. The PIN is a root key for key negotiation in the network configuration registration process, and is used for security authentication. The MAC address is a unique identifier of the IoT device, and is used to distinguish other IoT devices. It should be understood that the IoT device can also include other information, such as vendor information, etc., which are not limited by the embodiments of the present application.

[0102] S2. The device management module verifies whether the IoT device is a legal device in response to the registration request message.

[0103] S3. In the case that the IoT device is a legal device, the device management module sends a task request message to the timing task module.

[0104] After receiving the registration request message sent by the IoT device, the device management module first verifies whether the IoT device is a legal device. After verifying that the IoT device is a legal device, if the heartbeat period of the IoT device is to be adjusted periodically, the device management module needs to send a task request message to the timing task module to request the timing task module to create a heartbeat period adjustment task corresponding to the IoT device. In addition, the device management module stores the time when the IoT device is registered to the IoT device platform, so that the heartbeat period adjustment module can calculate the heartbeat period of the IoT device according to the registration time of the IoT device.

[0105] S4. The timing task module creates a heartbeat period adjustment task corresponding to the IoT device.

[0106] Exemplarily, the device management module takes the time when the IoT device is successfully verified as a legal device as the registration time of the IoT device, and carries the registration time of the IoT device in the task request message. After receiving the task request message from the device management module, the timing task module creates a heartbeat period adjustment task corresponding to the IoT device.

[0107] That is, taking the registration time of the IoT device as the starting time, the heartbeat period of the IoT device is calculated once in each execution cycle, so as to realize dynamic adjustment of the heartbeat period of the IoT device.

[0108] The execution cycle is used to determine the time interval for calculating the heartbeat period, for example, the execution cycle can be one week, half a month, one month, two months, etc., which can be adjusted according to actual use requirements, and the embodiments of the present application are not limited.

[0109] When different IoT devices request to register to the IoT platform, the IoT platform can create a heartbeat period adjustment task corresponding to each IoT device according to one or more factors such as the registration time of each IoT device, the device type of each IoT device, and the number of IoT devices registered to the IoT platform.

[0110] For example, Table 1 provides the correspondence between the number of IoT devices registered to the IoT platform, the device type of the IoT device, the registration time of the IoT device, the starting time of the heartbeat period adjustment task, and the execution cycle of the heartbeat period adjustment task.

[0111] Table 1

[0112]

[0113] As shown in Table 1, the registration times of the camera, alarm, smart screen and smart door lock are different, and accordingly, the starting times of each heartbeat period adjustment task are also different.

[0114] In addition, for IoT devices such as smart screens and cameras that are frequently remotely operated by users, the timing task module can set a shorter execution cycle for the heartbeat period adjustment task in order to increase the number of times the heartbeat period is calculated, so as to timely adjust the heartbeat period; and for IoT devices such as alarms and smart door locks that are not frequently remotely operated by users, the timing task module can set a longer execution cycle for the heartbeat period adjustment task in order to reduce the number of times the heartbeat period is calculated, thereby reducing the performance pressure of the IoT platform.

[0115] In addition, when the number of IoT devices registered to the IoT platform is smaller, the performance pressure of the IoT platform is smaller, and the timing task module can set a shorter execution cycle for the heartbeat period adjustment task in order to increase the number of times the heartbeat period is calculated, so that the heartbeat period adjustment module can more accurately estimate the heartbeat period of the IoT device. As the number of IoT devices registered to the IoT platform increases, the performance pressure of the IoT platform is greater, and at this time the timing task module can set a longer execution cycle for the heartbeat period adjustment task in order to reduce the number of times the heartbeat period is calculated, thereby reducing the performance pressure of the IoT platform.

[0116] S5. The timing task module returns a task success creation message to the device management module.

[0117] The task success creation message is used to indicate that the timing task module has successfully created the heartbeat period adjustment task.

[0118] S6. The device management module returns a successful registration result to the IoT device.

[0119] The successful registration result is used to indicate that the IoT device has successfully registered to the IoT platform.

[0120] In some embodiments, in order to realize remote control of the IoT device by the user device, the user device needs to commission the IoT device before the IoT device requests registration to the IoT platform. Taking the IoT device as a camera and the user device as a mobile phone as an example, when the user newly purchases the camera, the camera is connected to the power supply, the camera is powered on and device initialization is performed. The user opens the smart home APP on the mobile phone and clicks the control of adding the IoT device. The mobile phone starts to scan the surrounding IoT devices. The mobile phone displays a list of scanned surrounding IoT devices. The user selects the IoT device to be commissioned from the list, such as the camera. Then, the user inputs the Wi-Fi network password, the PIN of the camera, etc. The mobile phone starts to commission the camera and registers.

[0121] Stage two, data statistics

[0122] The IoT platform counts the active data of each period in the i-1th execution cycle through the following S7-S10.

[0123] S7. The user device sends first data to the data analysis module, and correspondingly, the data analysis module receives and stores the first data. The first data is used to indicate that the event of the user device remotely controlling the IoT device through the IoT platform occurs, which is referred to as a user device control event.

[0124] In some embodiments, the first data includes a first event identifier and a first time. The first event identifier is used to indicate the device control event, such as the first event identifier being 00. The first time is the occurrence time of the device control event, such as including year, month, day, and time.

[0125] In other embodiments, the first data can also include the identifier of the user device. It should be understood that since there can be multiple user devices, carrying the identifier of the user device in the first data can realize the differentiation of the user devices.

[0126] In yet some embodiments, the first data can further include an identification of the IoT device, and it is appreciated that since there can be multiple IoT devices, carrying the identification of the IoT device in the first data can enable to separately analyze the event data corresponding to each IoT device, and thus facilitate to calculate the heartbeat period corresponding to each IoT device.

[0127] In some embodiments, the device control event includes the following types:

[0128] Type 1, the user device sends a control instruction to the IoT device through the IoT platform, so as to control the IoT device to return various information collected by the IoT device to the user device through the IoT platform, such as controlling a camera to return collected video.

[0129] Type 2, the user device sends a control instruction to the IoT device through the IoT platform, so as to control the IoT device to perform one or more functions corresponding to the control instruction, such as controlling a smart speaker to play voice input by the user on the user device, or controlling an air purifier to perform air purification function.

[0130] In some embodiments, the data analysis module can obtain the first data in the following ways:

[0131] Way 1, when the user performs a control operation on the IoT APP of the user device, the user device generates a control instruction and carries the first data in the control instruction, and then sends the control instruction to the IoT platform, so that the data analysis module can parse the first data from the control instruction and store the first data. In addition, the IoT platform forwards the control instruction to the IoT device, and the IoT device performs a processing action corresponding to the control instruction.

[0132] Way 2, when the user performs a control operation on the IoT APP of the user device, the user device generates a control instruction and first data respectively, and then stores the first data and sends the control instruction without carrying the first data to the IoT platform. Then, the IoT platform forwards the control instruction to the IoT device, and the IoT device performs a processing action corresponding to the control instruction. Then, the user device can send the first data to the data analysis module at a preset time, such as reporting the data of the device control event occurring every day to the data analysis module once every day, or reporting the data of all device control events of the current period to the data analysis module before the next heartbeat period adjusts the execution period of the task.

[0133] In the third mode, when the user performs a control operation on the IoT APP of the user device, the user device generates a control instruction and sends the control instruction to the IoT platform. After receiving the control instruction, the IoT platform determines that the event of the user device remotely controlling the IoT device occurs, and thus the IoT platform can generate first data according to the control instruction and the system time at which the control instruction is received, and store the first data in the data analysis module. In addition, the IoT platform forwards the control instruction to the IoT device, and the IoT device performs a processing action corresponding to the control instruction.

[0134] S8. The user device sends second data to the data analysis module, and accordingly, the data analysis module receives and stores the second data. The second data is used to indicate the event of the user opening the IoT APP of the user device, that is, the event of the IoT APP of the user device switching to the foreground running state.

[0135] In some embodiments, the second data includes a second event identifier and a second time. The second event identifier is used to indicate the event of the IoT APP switching to the foreground running state, for example, the second event identifier is 01. The second time is the occurrence time of the event of the IoT APP switching to the foreground running state, for example, including year, month, day and time.

[0136] In another embodiment, the second data can also include the identifier of the user device. It should be understood that since there can be multiple user devices, carrying the identifier of the user device in the first data can realize the differentiation of the user devices.

[0137] In some embodiments, the user can trigger the IoT APP to switch to the foreground running state by clicking the application icon of the IoT APP of the user device, or clicking the background card of the IoT APP, or through the voice assistant.

[0138] In some embodiments, the data analysis module can obtain the second data in the following several ways:

[0139] In the first mode, when the user triggers the user device to switch to the foreground running state, the user device generates second data and immediately sends the second data to the IoT platform, so that the data analysis module can obtain the second data from the control instruction and store the second data.

[0140] Manner 2, when the user triggers the user equipment to switch to the foreground running state, the user equipment generates second data and stores the second data. The user equipment can send the second data to the data analysis module at a preset time, such as reporting the data of the IoT APP switching to the foreground running event occurring every day to the data analysis module once every day, or reporting all the IoT APP switching to the foreground running event data of the current period to the data analysis module before the next heartbeat period adjusts the execution period of the task.

[0141] It should be noted that in actual implementation, the user will first open the IoT APP of the user equipment, and then remotely control the IoT device through the IoT platform. According to the description of the above embodiment, since the first data and the second data have multiple reporting manners, the execution order of S7 and S8 is not limited in the embodiment of the application, and can be adjusted according to actual needs.

[0142] S9. The IoT device sends third data to the data analysis module, and correspondingly, the data analysis module receives and stores the third data. The third data is used to indicate an event of the IoT device reporting collected data to the IoT platform, which is referred to as a reporting collected data event.

[0143] It should be noted that the collected data reported by the IoT device to the IoT platform is various data collected by using wiring technology, network communication technology, security and protection technology, automatic control technology, and / or audio and video technology, such as sound, light, heat, electricity, mechanics, chemistry, biology, and / or position.

[0144] In some embodiments, the third data includes a third event identifier and a third time. The third event identifier is used to indicate the reporting collected data event, such as the third event identifier being 10. The third time is the occurrence time of the reporting collected data event, such as including year, month, day, and time.

[0145] In other embodiments, the third data can also include an identifier of the IoT device. It should be understood that since there can be multiple IoT devices, carrying the identifier of the IoT device in the third data can separately analyze and calculate the event data corresponding to each IoT device, and then facilitate the calculation of the heartbeat period corresponding to each IoT device.

[0146] In some embodiments, the data analysis module can obtain the third data in the following several manners:

[0147] Manner 1, after the IoT device collects data, the IoT device analyzes the data, and if the reporting condition is met, the IoT device actively sends the third data to the IoT platform, and the third data includes the collected data and the current system time.

[0148] For example, taking a camera as an example, if the camera analyzes data and finds that a stranger has invaded, the camera sends alarm information containing collected video data and current system time to the IoT platform, and the IoT platform forwards the alarm information to the user device, that is, an alarm event occurs. For another example, the user pre-sets the hygrometer to report the temperature and humidity value every certain period of time, and the hygrometer reports the temperature and humidity value to the IoT platform every time the preset period of time is reached, and the IoT platform sends the temperature and humidity value to the user device.

[0149] In mode 2, the IoT device receives a control instruction from the user device, and the control instruction is used to instruct the IoT device to report collected data. The IoT device responds to the control instruction and sends third data to the IoT platform after collecting the data, and the third data includes the collected data and the current system time. Then, the IoT platform forwards the third data to the user device.

[0150] S10. The IoT device sends fourth data to the data analysis module, and correspondingly, the data analysis module receives and stores the fourth data. The fourth data is used to indicate that an offline event of the IoT device occurs.

[0151] In some embodiments, the fourth data includes a fourth event identifier and a fourth time. The fourth event identifier is used to indicate the offline event of the IoT device, such as the fourth event identifier being 11. The fourth time is the occurrence time of the offline event of the IoT device, such as including year, month, day, and time.

[0152] In another embodiment, the fourth data can also include the identifier of the IoT device. It should be understood that since there can be multiple IoT devices, carrying the identifier of the IoT device in the fourth data can separately analyze the event data corresponding to each IoT device, and then facilitate the calculation of the heartbeat period corresponding to each IoT device.

[0153] In some embodiments, the data analysis module can obtain the fourth data in the following ways:

[0154] In mode 1, after the IoT device sends the heartbeat packet to the IoT platform, if the IoT platform does not return the heartbeat response within the time threshold, the IoT device disconnects the TCP connection with the server. After re-establishing the TCP connection, the IoT device immediately sends the fourth data to the IoT platform, and the fourth data includes the fourth event identifier and the fourth time.

[0155] Manner 2, after the IoT device sends the heartbeat packet to the IoT platform, if the IoT platform does not return the heartbeat response within the time threshold, the IoT device records the fourth data. Then, the IoT device can send the fourth data to the data analysis module at a preset time, such as reporting the data of the IoT device offline event occurring every week to the data analysis module once every week, or reporting the data of all IoT device offline events in the current period to the data analysis module before adjusting the execution period of the task in the next heartbeat period.

[0156] Manner 3, when the time threshold is exceeded and the IoT platform does not receive the heartbeat packet from the IoT device, the TCP connection with the IoT device is disconnected, and the fourth data including the fourth event identifier and the fourth time is recorded by the data analysis module.

[0157] Stage three, calculate the heartbeat period

[0158] In the above stage one, the timing task module creates a heartbeat period adjustment task corresponding to the IoT device: taking the registration time of the IoT device as the starting time, in each execution period, the heartbeat period of the IoT device is calculated. When the system time of the IoT platform reaches the starting time of any execution period, the timing task module can trigger the heartbeat period adjustment module to calculate the heartbeat period of the IoT device in the execution period. Taking the i th execution period as an example, the heartbeat period adjustment module can calculate the heartbeat period of each period in the i th execution period according to the active data in each period in the i-1 th execution period through S11-S16. Wherein, i is an integer greater than 1.

[0159] S11. After the timing task module creates a heartbeat period adjustment task corresponding to the IoT device, if the system time of the IoT platform reaches the starting time of the i th execution period of the heartbeat period adjustment task, the timing task module sends information to the heartbeat period adjustment module, which is used to instruct the heartbeat period adjustment module to calculate the heartbeat period of the IoT device in the i th execution period.

[0160] The embodiment of the present application can divide an execution period into multiple periods with equal or unequal time intervals.

[0161] In the first implementation, when the user's activity levels in different time periods of an execution cycle are close to each other, the heart beat cycle adjustment module can calculate a heart beat cycle for the IoT device in the execution cycle. For example, if the heart beat cycle of the IoT device in the first month is calculated to be 0.1T, the IoT device sends a heart beat packet to the IoT platform according to the heart beat cycle of 0.1T; if the heart beat cycle of the IoT device in the second month is calculated to be 0.2T, the IoT device sends a heart beat packet to the IoT platform according to the heart beat cycle of 0.2T. Wherein, T is a regular fixed heart beat cycle, for example, the fixed heart beat cycle of the IoT device in the smart home field is usually 60 seconds.

[0162] In the second implementation, when the user's activity levels in different time periods of an execution cycle are significantly different, for example, the user's probability of using the IoT device is higher in the daytime from 07:00 to 08:59, and the user's probability of using the IoT device is lower in the night from 00:00 to 01:59, in this case, the heart beat cycle adjustment module can calculate a heart beat cycle for each time period of an execution cycle.

[0163] It should be noted that the following embodiments are exemplarily described by taking the second implementation for calculating the heart beat cycle of the IoT device as an example, which does not limit the embodiments of the present application, and the first implementation can also be used to calculate the heart beat cycle of the IoT device in actual implementation.

[0164] S12. The heart beat cycle adjustment module sends a request message to the device management module to query the registration time of the IoT device. Correspondingly, the device management module queries the registration time of the IoT device in response to the request message, and returns a response message to the heart beat cycle adjustment module, the response message including the registration time of the IoT device.

[0165] S13. The heart beat cycle adjustment module calculates a basic heart beat cycle corresponding to the i th execution cycle according to the registration time of the IoT device.

[0166] In the embodiments of the present application, a large amount of data of the user using the user device to control the IoT device can be obtained in advance, and then a data analysis algorithm is used to analyze these data, and the regularity of the user using the IoT device in different time periods after the IoT device is registered to the IoT platform is counted. Then, the registration time of the IoT device is taken as the starting time to divide multiple execution cycles, and a basic heart beat cycle corresponding to each execution cycle is set.

[0167] It should be noted that the "execution cycle" here is the execution cycle of the heart beat cycle adjustment task.

[0168] Generally, when a user newly purchases an IoT device, the user has a strong sense of novelty for the IoT device, and the user device is used to remotely control the IoT device more frequently. In this case, the basic heartbeat period corresponding to one execution period can be set shorter, so as to increase the number of times of calculating the heartbeat period, thereby enabling the user to quickly perceive the real status of the IoT device through the user device. After a period of time, as the user's sense of novelty for the IoT device weakens, the user device is used to remotely control the IoT device less frequently. In this case, the basic heartbeat period corresponding to one execution period can be set longer, so as to reduce the number of times of calculating the heartbeat period, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform.

[0169] Exemplarily, Table 2, Table 3 and Table 4 show the correspondence between the three preset execution periods and basic heartbeat periods. In Table 2 and Table 3, the execution period is in units of 1 month, and the IoT platform adjusts the basic heartbeat period every 1 month, for example, the basic heartbeat period is 0.1T in the first month, the basic heartbeat period is 0.5T in the second month, and the basic heartbeat period T is maintained after the registration time reaches a certain month, because the frequency of the user using the IoT device basically no longer changes frequently. In Table 4, the execution period is in units of 2 weeks, and the IoT platform adjusts the basic heartbeat period every 2 weeks, for example, the basic heartbeat period is 0.1T in the first-2 weeks, the basic heartbeat period is 0.3T in the third-4 weeks, and the basic heartbeat period T is maintained after the registration time reaches a certain week. Wherein, T is a regular fixed heartbeat period. It should be understood that the shorter the execution period of the heartbeat period adjustment task is, the more frequent the basic heartbeat period adjustment is, and the more accurate the basic heartbeat period is.

[0170] Table 2

[0171] Execution cycle 1st month 2nd month 3rd month and onwards Basic heartbeat cycle 0.1T 0.5T T

[0172] Table 3

[0173] Execution cycle 1st month 2nd month 3rd month 4th month and onwards Basic heartbeat cycle 0.1T 0.5T 0.9T T

[0174] Table 4

[0175] Execution cycle 1st-2nd week 3rd-4th week 5th-6th week 7th week and onwards Basic heartbeat cycle 0.1T 0.3T 0.5T T

[0176] The above embodiment introduces the basic heartbeat period. The basic heartbeat period is obtained according to a large amount of user data analysis, and there are individual differences between different users, and there may be differences in different time periods of a same user in an execution period. If all users send heartbeat packets by using the same basic heartbeat period, there may be problems that some users cannot quickly and truly perceive the state of the IoT device through the user equipment, or the power consumption of some IoT devices is high. Therefore, the present application proposes that a basic heartbeat period is set for each execution period according to the registration time of the IoT device, and then the basic heartbeat period is taken as a reference period, and the basic heartbeat period is dynamically adjusted according to the active index of the user equipment controlling the IoT device, the active index of the user opening the IoT APP, the active index of the IoT device reporting collected data and / or the offline active index of the IoT device in the last execution period, so as to more accurately calculate the final heartbeat period.

[0177] The implementation mode of dynamically adjusting the basic heartbeat period is introduced below through S14-S15.

[0178] S14. The heartbeat period adjustment module sends a request message to the data analysis module to query the active data in each time period in the i-1th execution period. Correspondingly, the data analysis module analyzes the various data obtained through S7-S10 to obtain the active data in each time period in the i-1th execution period, and returns the active data in each time period in the i-1th execution period to the heartbeat period adjustment module.

[0179] The active data of each time period is used to reflect the activity degree of the IoT device in the time period.

[0180] It should be noted that the “i-1th execution period” in the embodiment of the present application is the last execution period of the “i th execution period”. In the “i-1th execution period”, the IoT platform calculates the heartbeat period for the IoT device, the IoT device sends heartbeat packets to the IoT platform according to the heartbeat period to maintain the long connection, and then the data analysis module of the IoT platform obtains four types of data: the first data indicating that the user equipment control event occurs, the second data indicating that the user equipment IoT APP switching to the foreground running state event occurs, the third data indicating that the IoT device reporting collected data event occurs, and the fourth data indicating that the IoT device offline event occurs. In the “i th execution period”, after the data analysis module receives the request message of the heartbeat period adjustment module, the data analysis module can statistically analyze one or more types of data in the “i-1th execution period” according to the time period, so as to recalculate the heartbeat period for the IoT device, and then make the IoT device send heartbeat packets to the IoT platform according to the updated heartbeat period in the i th execution period.

[0181] In combination with the description of S11, the data analysis module can divide one execution period into multiple time intervals with equal or unequal time intervals. When the activity of the user using the IoT device in different time intervals in one execution period is significantly different, the data analysis module can analyze the data of each time interval in the previous execution period to obtain the activity data of each time interval in the current execution period.

[0182] For example, taking the i-1th execution period as an example. The i-1th execution period includes N sub-periods, for example, the i-1th execution period is 1 month, and 1 sub-period is 1 day. The data analysis module divides each sub-period into multiple time intervals, for example: 1 day is divided into 48 time intervals with a unit of 30 minutes; or 1 day is divided into 24 time intervals with a unit of 1 hour; or 1 day is divided into 12 time intervals with a unit of 2 hours.

[0183] In some embodiments, the activity data of each time interval is specifically the user activity index. For the four types of data obtained in the i-1th execution period, the data analysis module can count the number of events indicated by each type of data occurring in each time interval, and calculate the user activity index in each time interval according to the number of events indicated by each type of data occurring in each time interval.

[0184] The following provides a specific implementation of calculating the user activity index in each time interval according to the number of events occurring in each time interval:

[0185] Suppose the i-1th execution period includes 30 days, and the data analysis module divides each day into 12 time intervals, then there are:

[0186] Equation 1: i1=k1*f1. Wherein, f1 is used to represent the number of user device control events occurring in the jth time interval of the 1st to 30th day, and i1 is used to represent the user activity index corresponding to the user device control event.

[0187] Equation 2: i2=k2*f2. Wherein, f2 is used to represent the number of events of the IoT APP of the user device switching to the foreground running state occurring in the jth time interval of the 1st to 30th day, and i2 is used to represent the user activity index corresponding to the event of the IoT APP of the user device switching to the foreground running state.

[0188] Equation 3: i3=k3*f3. Wherein, f3 is used to represent the number of IoT device reported data collection events occurring in the jth time interval of the 1st to 30th day, and i3 is used to represent the user activity index corresponding to the IoT device reported data collection event.

[0189] Relationship 4: i4=k4*f4. Wherein, f4 is used to represent the number of times of IoT device offline event occurrence in the jth time period from the 1st day to the 30th day, i4 is used to represent the user active index corresponding to the IoT device offline event.

[0190] In the above relationship 1-relationship 4, 1≤j≤12, and j is an integer. In addition, k1, k2, k3 and k4 are preset proportion coefficients, k1, k2, k3 and k4 can be equal, such as k1, k2, k3 and k4 are all 0.1, or k1, k2, k3 and k4 are all 0.5, of course k1, k2, k3 and k4 can also be not equal, which can be adjusted according to actual needs, and the embodiments of the application are not limited.

[0191] Exemplarily, taking k1, k2, k3 and k4 all equal to 0.1 as an example for illustration. Table 5 below shows the correspondence between the preset time period, the number of times of occurrence of a certain type of event, and the user active index. As shown in Table 5, the first row is used to represent the number of times of occurrence of a certain type of event, the first column is used to represent the time period, and the rest of the table is used to represent the user active index corresponding to the time period and the number of times of occurrence of the event. For example, in the time period 00:00-01:59, if the event occurs 1 time, the user active index is 0.1, and if the event occurs 2 times, the user active index is 0.2. For another example, in the time period 12:00-13:59, if the event occurs 29 times, the user active index is 2.9, and if the event occurs 30 times, the user active index is 3.

[0192] Table 5

[0193]

[0194]

[0195] It should be noted that the number of times corresponding to any one time period in Table 5 above is obtained by statistical analysis of the data of this time period from the 1st day to the last day in the i-1th execution cycle. For example, the number of times corresponding to 00:00-01:59: the number of times corresponding to 00:00-01:59 on the 1st day, the number of times corresponding to 00:00-01:59 on the 2nd day, the number of times corresponding to 00:00-01:59 on the 3rd day, …, the number of times corresponding to 00:00-01:59 on the 30th day are added. That is, any one time period in Table 5 is composed of a plurality of non-consecutive sub-periods.

[0196] In addition, if the number of times of occurrence of a certain type of event in any one time period of an execution cycle is 0, i.e. no certain type of event occurs in the time period, the corresponding user active index is set to 0.

[0197] The event of a certain type can occur one or more times in a time period of a sub-period. The data analysis module can count all the times of the event of the certain type occurring in the time period of each sub-period, and take the product of all the times and a preset proportion coefficient as the user activity index corresponding to the event of the certain type.

[0198] Exemplarily, taking the user device control event as an example. It is assumed that the i-1th execution period includes 30 sub-periods, each of which is 1 day. Table 6 shows the times of the user device control event occurring in the first time period of each day, where the first time period is any one of the 12 time periods of a day. The data analysis module can sum all the times of the user device control event occurring in the time period of the 30 days to obtain a total time of 15 times. If k = 0.1, then according to the relationship i1 = k * f1, the user activity index corresponding to the user device control event is 1.5.

[0199] Table 6

[0200]

[0201] However, in some special cases, the event of the certain type can occur a large number of times only in a small number of sub-periods, and the event of the certain type does not occur or occurs only once in most sub-periods. If the above-mentioned manner is adopted, a larger user activity index will be obtained, which deviates greatly from the actual situation and has the possibility of misjudgment. Therefore, another manner is provided in the embodiments of the present application: if the event of the certain type occurs one or more times in a time period of a sub-period, it is recorded as one time; if the event of the certain type does not occur in a time period of a sub-period, it is recorded as 0 times. In this way, the maximum number of times of the event of the certain type occurring in the time period of the first day to the last day of the i-1th execution period is 30.

[0202] Exemplarily, taking the IoT device offline event as an example. It is assumed that the i-1th execution period includes 30 days. Table 7 shows the times of the IoT device offline event occurring in the second time period of each day, where the second time period is any one of the 12 time periods of a day. Among them, the IoT device offline event occurs 10 times in the second time period of the 7th day, which is recorded as 1 time; the IoT device offline event occurs 1 time in the second time period of the 16th day; the IoT device offline event occurs 1 time in the second time period of the 18th day. The data analysis module can obtain a total time of 3 times. If k = 0.1, then according to the relationship i4 = k * f4, the user activity index corresponding to the IoT device offline event is 0.3. It should be understood that the number of times of the IoT device offline event occurring on the 7th day is large, which can be caused by special reasons such as network service provider failure, and if 10 times are recorded as 1 time, the possibility of misjudgment can be reduced, and a more accurate user activity index can be obtained.

[0203] Table 7

[0204]

[0205] It should be noted that the above S14 is an example of dividing the i-1th execution period into multiple time periods and calculating the user activity index of each time period, which does not limit the embodiments of the present application. In actual implementation, if the activity degrees of the user using the IoT device at different time or time periods in an execution period are close, the heartbeat period adjustment module can also calculate only one user activity index for the execution period, and calculate one heartbeat period for the IoT device according to the user activity index.

[0206] S15. The heartbeat period adjustment module calculates the heartbeat period (period for sending heartbeat messages) of each time period in the i th execution period according to the basic heartbeat period corresponding to the i th execution period and the activity data of each time period in the i-1th execution period. Wherein, the heartbeat period of each time period is used to determine the time interval of sending the heartbeat packet by the IoT device to the IoT platform in the time period.

[0207] In the embodiments of the present application, the activity data of each time period in the i-1th execution period is used to reflect the activity degree of the IoT device in the time period. If the activity data of a time period in the i-1th execution period indicates that the IoT device is relatively active in the time period, and the probability of the user using the IoT device in the time period is relatively large, the heartbeat period adjustment module can adjust the basic heartbeat period corresponding to the i th execution period to shorten the heartbeat period of the long connection, so as to maximize the consistency between the online state of the IoT device and the database record. If the activity data of a time period in the i-1th execution period indicates that the IoT device is not very active in the time period, and the probability of the user using the IoT device in the time period is relatively small, the heartbeat period adjustment module can adjust the basic heartbeat period corresponding to the i th execution period to lengthen the heartbeat period of the long connection, so as to reduce the power consumption of the IoT device and the performance pressure of the IoT platform.

[0208] In combination with the above description of S14, the active data of each time period in the i-1th execution cycle can be a user activity index, and each type of event corresponds to a user activity index. For example, the user activity index corresponding to the user device control event is i1, the user activity index corresponding to the event that the IoT APP of the user device switches to the foreground running state is i2, the user activity index corresponding to the event that the IoT device reports collected data is i3, and the user activity index corresponding to the IoT device offline event is i4. In some embodiments, the heartbeat period adjustment module can directly adjust the basic heartbeat period according to at least one of the user activity index i1, the user activity index i2, the user activity index i3, and the user activity index i4 of each time period to obtain the heartbeat period of each time period. In other embodiments, since the influence of these events on the heartbeat period is different, for example, the influence of the user device control event on the heartbeat period is relatively high, and the influence of the IoT device offline event on the heartbeat period is relatively low, therefore, the present application sets a weight coefficient corresponding to each event, adjusts the user activity index of each event according to the weight coefficient, and then adjusts the basic heartbeat period according to the adjusted user activity index of each event to obtain the heartbeat period of each time period.

[0209] Assuming that the basic heartbeat period is represented by T1, the weight coefficient of the user device control event is represented by F1, the weight coefficient of the event that the IoT APP switches to the foreground running state is represented by F2, the weight coefficient of the event that the IoT device reports collected data is represented by F3, and the weight coefficient of the IoT device offline event is represented by F4, then the heartbeat period T2 of a certain time period in the i th execution cycle can be calculated using the following relationship:

[0210]

[0211] Exemplarily, Table 8 shows the weight coefficient F1 of the user device control event, the weight coefficient F2 of the event that the IoT APP switches to the foreground running state, the weight coefficient F3 of the event that the IoT device reports collected data, and the weight coefficient F4 of the IoT device offline event.

[0212] Table 8

[0213]

[0214] It should be noted that each weight coefficient in Table 8 is exemplary and can be adjusted according to actual needs.

[0215] The following is an example of the corresponding relationship between the execution cycle and the basic heartbeat period shown in Table 2 and the weight coefficients of each type of event shown in Table 8.

[0216] Assuming i = 1, in the 11:00-12:59 of the first execution cycle, the user device control event occurs 10 times, the IoT APP switching to the foreground running state event occurs 5 times, the IoT device reporting collected data event occurs 3 times, and the IoT device offline event occurs 5 times, then there are:

[0217]

[0218] Thus, the heartbeat period adjustment module calculates that the heartbeat period of the IoT device in the second execution cycle is 0.0562T.

[0219] Assuming i = 2, in the 11:00-12:59 of the second execution cycle, the user device control event occurs 4 times, the IoT APP switching to the foreground running state event occurs 1 time, the IoT device reporting collected data event occurs 2 times, and the IoT device offline event occurs 2 times, then there are:

[0220]

[0221] Thus, the heartbeat period adjustment module calculates that the heartbeat period of the IoT device in the third execution cycle is 0.2941T.

[0222] Assuming i = 3, in the 11:00-12:59 of the third execution cycle, the user device control event occurs 3 times, the IoT APP switching to the foreground running state event occurs 2 times, the IoT device reporting collected data event occurs 2 times, and the IoT device offline event occurs 1 time, then there are:

[0223]

[0224] Thus, the heartbeat period adjustment module calculates that the heartbeat period of the IoT device in the fourth execution cycle is 0.3226T.

[0225] Assuming T = 60 seconds. As Figure 5As shown, in the first execution cycle, the heartbeat period adjustment module sets the heartbeat periods of 11:00-12:59 to the default basic heartbeat period 0.1T=6 seconds. In the second execution cycle, the heartbeat period adjustment module calculates the final heartbeat periods of 11:00-12:59 to be 0.0562T=3.372 seconds according to the data collected in the first execution cycle and the basic heartbeat period 0.5T. In the third execution cycle, the heartbeat period adjustment module calculates the final heartbeat periods of 11:00-12:59 to be 0.2941T=17.646 seconds according to the data collected in the second execution cycle and the basic heartbeat period T. In the fourth execution cycle, the heartbeat period adjustment module calculates the final heartbeat periods of 11:00-12:59 to be 0.3226T=19.356 seconds according to the data collected in the third execution cycle and the basic heartbeat period T. It can be seen that, as the number of events of each type decreases, the probability of the user using the IoT device in the time period also gradually decreases, and the power consumption of the IoT device and the performance pressure of the IoT platform can be reduced by prolonging the heartbeat period of the long connection.

[0226] S16. The heartbeat period adjustment module sends a heartbeat period adjustment instruction to the IoT device, the heartbeat period adjustment instruction including the heartbeat periods corresponding to each time period in the i-th execution cycle. Correspondingly, the IoT device receives the heartbeat period adjustment instruction from the heartbeat period adjustment module.

[0227] If each time period of the i-th execution cycle corresponds to a heartbeat period, the heartbeat period adjustment module can carry the heartbeat periods corresponding to each time period in the i-th execution cycle in one heartbeat period adjustment instruction.

[0228] Stage four, recording and querying the status of the IoT device

[0229] The IoT platform can record the status of the IoT device by S17-S18 below. The user device can query the status of the IoT device by S19-S20 below.

[0230] S17. In each time period in the i-th execution cycle, the IoT device sends a heartbeat packet to the status management module of the IoT platform according to the heartbeat period corresponding to each time period. Correspondingly, the status management module returns a heartbeat response to the IoT device after receiving the heartbeat packet. The heartbeat response and the heartbeat packet carry the same data for verification.

[0231] Exemplarily, Figure 6 A flowchart of the process in which the IoT device maintains a long connection is shown. Figure 7 A schematic diagram of the heartbeat synchronization process between the IoT device and the IoT platform in the three time periods of the i-th execution cycle is shown. As shown, Figure 6As shown, in the i-th execution cycle, the IoT device receives the heartbeat cycle adjustment instruction from the heartbeat cycle adjustment module. If the IoT device has established a TCP connection with the IoT platform, in each time period of the i-th execution cycle, the IoT device sends a Ping frame to the state management module of the IoT platform according to the heartbeat cycle corresponding to each time period. For example, as shown in FIG. 6, the IoT device sends a Ping frame to the state management module of the IoT platform every 26 seconds in the time period of 06:00-07:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. The IoT device sends a Ping frame to the state management module of the IoT platform every 19 seconds in the time period of 08:00-09:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. The IoT device sends a Ping frame to the state management module of the IoT platform every 15 seconds in the time period of 10:00-11:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. Figure 7 As shown, when the heartbeat cycle adjustment module of the IoT platform sets the heartbeat cycle of the IoT device in the time period of 06:00-07:59 to 26 seconds, the IoT device sends a Ping frame to the state management module of the IoT platform every 26 seconds in the time period of 06:00-07:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. When the heartbeat cycle adjustment module of the IoT platform sets the heartbeat cycle of the IoT device in the time period of 08:00-09:59 to 19 seconds, the IoT device sends a Ping frame to the state management module of the IoT platform every 19 seconds in the time period of 08:00-09:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. When the heartbeat cycle adjustment module of the IoT platform sets the heartbeat cycle of the IoT device in the time period of 10:00-11:59 to 15 seconds, the IoT device sends a Ping frame to the state management module of the IoT platform every 15 seconds in the time period of 10:00-11:59, and the state management module returns a Pong frame to the IoT device after receiving the Ping frame within a first preset time. After the IoT device receives the Pong frame within a preset time threshold, it is determined that the current long connection is valid, and the IoT device continues to send a Ping frame to the state management module of the IoT platform according to the heartbeat cycle corresponding to each time period. If the IoT device does not receive the Pong frame within a second preset time, it is marked as a heartbeat failure 1 time, and in the case that the cumulative number of times reaches a preset Y times, it is determined that the current long connection is invalid, the TCP connection with the IoT platform is disconnected, and a TCP connection is re-established. The first preset time and the second preset time are equal or unequal.

[0232] S18. The state management module records the state of the IoT device in the database according to the reception of the heartbeat packet.

[0233] If the state management module receives the heartbeat packet within the time threshold, it is determined that the long connection between the IoT platform and the IoT device is in a valid state, i.e., the IoT device is in an online state. If the state management module does not receive the heartbeat packet within the time threshold, it is determined that the long connection between the IoT platform and the IoT device is in an invalid state, i.e., the IoT device is in an offline state. The state management module records the state of the IoT device, i.e., online state / offline state, in the database in real time.

[0234] S19. In response to the user operation, the user equipment sends a request message to the state management module to query the state of the IoT device. Accordingly, in response to the request message, the state management module queries the database for the state of the IoT device and sends a response message to the user equipment, the response message including the state of the IoT device.

[0235] S20. The user equipment outputs the status of the IoT device based on the response message.

[0236] In some embodiments, user actions may include triggering the IoT APP to run in the foreground or triggering the display of the interface of an IoT device.

[0237] For example, after a user device is registered with the IoT platform, the user can open the IoT app on the user device at any time. For instance, the user can click on... Figure 8 The smart home icon 81 is shown in (a) in the image. The smart home process has switched to the foreground running state, and is displayed as shown below. Figure 8 The smart home main interface shown in (b) includes icons for multiple IoT devices pre-registered with the IoT platform, such as camera icon 82, air purifier icon, washing machine icon, and light bulb icon. If the user clicks camera icon 82, the user device sends a request message to the IoT platform's status management module to query the camera's status. In response to the request message, the status management module queries the database for the camera's status and sends a response message to the user device, which includes the camera's status.

[0238] If the response message indicates that the camera is online, then the user device will display as follows: Figure 8 The interface shown in (c) includes the camera's device identifier, online status identifier 83, video playback control 84, network settings control, account security control, photo album control, and account security control. By viewing the online status identifier 83, the user can determine that the camera is online, and then click the video playback control 84 to trigger the camera to send the real-time captured video to the user's device, allowing the user to remotely view the indoor monitoring images.

[0239] If the response message indicates that the camera is offline, then the user device will display as follows: Figure 8 The interface shown in (d) is as follows. This interface includes the camera's device identifier, offline status identifier 85, video playback controls, network settings controls 86, account security controls, album controls, and account security controls. By viewing the offline status identifier 85, the user can determine that the camera is offline and cannot remotely view the indoor monitoring images captured by the camera. At this time, the user can click the network settings control 86 to trigger a network fault detection between the user's device and the camera, and then reconnect to the network.

[0240] It can be understood that, since the IoT platform can dynamically adjust the heartbeat period of the IoT device according to the registration time of the IoT device, the offline time of the IoT device, the time when the user device controls the IoT device, and the like. When the probability of the user using the IoT device is low, the heartbeat period is extended, thereby reducing the power consumption of the IoT device and the performance pressure of the IoT platform. When the probability of the user using the IoT device is high, the heartbeat period is shortened, thereby maximizing the consistency between the online state of the IoT device and the database record, and improving the user experience. In this way, a win-win of device performance and power consumption and user experience is achieved.

[0241] The above mainly introduces the scheme provided by the present application from the perspective of interaction among the IoT platform, the IoT device, and the user device. It can be understood that, in order to implement the above functions, each network element includes a hardware structure and / or a software module or unit for executing each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is implemented in hardware or computer software driven hardware depends on the specific application of the technical solution and the design constraints. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0242] The embodiments of the present application can divide the functions of the device into function modules according to the above method examples. For example, each function module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or software function module. It should be noted that the division of modules in the embodiments of the present application is illustrative, and is only a logical function division. Actual implementation can have another division manner. The following takes the division of each function module according to each function as an example for description.

[0243] In the case of using integrated modules or units, Figure 9 A possible example block diagram of the apparatus involved in the embodiments of the present application is shown, which apparatus 900 exists in the form of software. The apparatus 900 can include a processing unit 901 and a communication unit 902. The processing unit 901 is used to control and manage the actions of the apparatus 900. The communication unit 902 is used to support the communication of the apparatus 900 with other devices. The communication unit 902, also called a transceiver unit, can include a receiving unit and / or a sending unit, which are used to perform receiving and sending operations, respectively.

[0244] The processing unit 901 can be a processor or a controller, which can implement or execute the various exemplary logical blocks, modules, and circuits described in combination with the disclosure of the embodiments of the present application. The communication unit 902 can be a communication interface, a transceiver, or a transceiving circuit, etc., wherein the communication interface is collectively referred to, and in a specific implementation, the communication interface can include multiple interfaces.

[0245] The device 900 can be an IoT platform in any of the above-described embodiments, or can also be a semiconductor chip disposed in the IoT platform. The processing unit 901 can support the device 900 to perform the actions of the IoT platform in each of the above method examples. Alternatively, the processing unit 901 mainly performs the internal actions of the IoT platform in the method examples, and the communication unit 902 can support the communication between the device 900 and other devices.

[0246] In some embodiments, the processing unit 901 is configured to: determine that a system time of the IoT platform reaches a start time of an i th execution period of a heartbeat period adjustment task; determine a basic heartbeat period corresponding to the i th execution period according to a time at which the IoT device is registered to the IoT platform; and adjust the basic heartbeat period corresponding to the i th execution period according to active data of a target time period in an (i-1) th execution period, to obtain a heartbeat period of the target time period in the i th execution period, the target time period being any one of M time periods included in the (i-1) th execution period and the i th execution period respectively, and the active data being used to indicate an activity level of the IoT device in the target time period of the (i-1) th execution period.

[0247] The communication unit 902 is configured to: send an instruction to the IoT device, the instruction including the heartbeat period of each time period in the i th execution period, and the heartbeat period of each time period in the i th execution period being used to determine a time interval at which the IoT device sends a heartbeat packet to the IoT platform in each time period.

[0248] In other embodiments, the processing unit 901 is further configured to: obtain a number of times of occurrence of a target event in the target time period of the (i-1) th execution period, the target event being associated with the IoT device; and obtain a user activity index of the target time period in the (i-1) th execution period according to the number of times of occurrence of the target event, the user activity index being in a positive proportional relationship with the number of times of occurrence of the target event. The target event includes at least one of: a first event, the first event being an event in which the user device controls the IoT device through the IoT platform; a second event, the second event being an event in which an IoT application of the user device switches to a foreground running state, the IoT application being used to control the IoT device; a third event, the third event being an event in which the IoT device reports collected data to the IoT platform; and a fourth event, the fourth event being an offline event of the IoT device.

[0249] In some embodiments, the communication unit 902 is further configured to receive, at the i-1th execution cycle, first data and second data from the user equipment, the first data indicating the first event and the second data indicating the second event; and receive, at the i-1th execution cycle, third data and fourth data from the IoT device, the third data indicating the third event and the fourth data indicating the fourth event.

[0250] In some embodiments, the communication unit 902 is further configured to receive a registration request message from the IoT device. The processing unit 901 is further configured to verify, in response to the registration request message, that the IoT device is a legitimate device, and create a heartbeat cycle adjustment task. The communication unit 902 is further configured to send a successful registration message to the IoT device.

[0251] In some embodiments, the processing unit 901 is further configured to determine that the IoT device is in an online state if the communication unit 902 receives a heartbeat packet from the IoT device within a preset time, and send a heartbeat response to the IoT device through the communication unit 902; or determine that the IoT device is in an offline state if the communication unit 902 does not receive a heartbeat packet from the IoT device within the preset time, and disconnect the connection with the IoT device. The heartbeat packet and the heartbeat response are used to maintain a long connection between the IoT device and the IoT platform.

[0252] The embodiments of the present application also provide an IoT platform, which can be applied to a system as shown in Figure 2 FIG. 1, and is configured to perform the functions of the IoT platform in the above embodiments. As shown in FIG. 1, the IoT platform 100 can include a communication interface 101, a processor 102, and a memory 103. Figure 10

[0253] ​The processor 102 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP, etc. The processor 102 can also include a hardware chip. The hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The processor 102 can be implemented by hardware, and of course, can also be implemented by executing corresponding software by hardware.

[0254] The communication interface 101 and the processor 102 are connected to each other. In some embodiments, the communication interface 101 and the processor 102 are connected to each other through a bus 104. The bus 104 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 10 In the figure, only one thick line is used to represent the bus, but it does not mean that there is only one bus or only one type of bus.

[0255] The memory 103 is coupled to the processor 102 and is used to store programs, etc. Specifically, the program can include program code including computer operation instructions. The processor 102 executes the application program stored in the memory 103 to implement the operation of the IoT platform in the above embodiments.

[0256] Specifically, when implementing the operation of the IoT platform in the above embodiments, the IoT platform 100 can include:

[0257] The communication interface 101 is used to transceive data and communicate with other devices or apparatuses in the system;

[0258] The processor 102 is configured to execute a program stored in the memory 103. When the program is executed, the processor 102 determines that the system time of the IoT platform reaches the start time of the i th execution period of the heartbeat period adjustment task; determines the base heartbeat period corresponding to the i th execution period according to the time when the IoT device is registered to the IoT platform; and adjusts the base heartbeat period corresponding to the i th execution period according to the active data of the target period in the i-1 th execution period, to obtain the heartbeat period of the target period in the i th execution period, the target period being any one of the M periods included in the i-1 th execution period and the i th execution period, and the active data being used to indicate the activity level of the IoT device in the target period of the i-1 th execution period. The processor 102 and the communication interface 101 can also perform other possible operations of the IoT platform in the above method embodiments, which are not described herein.

[0259] Based on the above embodiments, the application further provides an IoT device, which comprises a communication interface, a processor and a memory, the processor being coupled to the memory, and the processor being configured to execute a computer program or instructions stored in the memory, so that the IoT device performs other possible operations of the IoT device in the above method embodiments, which are not described herein.

[0260] Based on the above embodiments, the application further provides a computer readable storage medium, which stores computer instructions; when the computer readable storage medium is run on an IoT platform or an IoT device, the IoT platform or the IoT device performs the method as shown above. The computer instructions can be stored in the computer readable storage medium, or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium accessible by a computer or a data storage device such as one or more servers, data centers, etc. integrated with one or more media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk or a magnetic tape), an optical medium or a semiconductor medium (for example, a solid state disk (SSD)) and the like.

[0261] The application also provides a computer program product, which comprises computer program code, when the computer program code is run on a computer, the computer executes the method in each of the above embodiments.

[0262] The chip is coupled with the memory, and is configured to read and execute the computer program or instructions stored in the memory to perform the method in any of the above embodiments. The chip can be a general processor or a special processor. In some embodiments, the chip further comprises a memory for storing the program instructions and data necessary for the processor to execute.

[0263] It should be noted that the chip can be implemented using one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuitry, or any combination thereof capable of performing the various functions described throughout this application.

[0264] The IoT platform, the IoT device, the user equipment, the apparatus, the computer readable storage medium, the computer program product, and the chip provided by the embodiments of the present application are used to execute the method provided above, and thus the beneficial effects achieved thereby can refer to the beneficial effects of the method provided above, which will not be repeated here.

[0265] It should be understood that the above is only to help those skilled in the art better understand the embodiments of the present application, and not to limit the scope of the embodiments of the present application. Those skilled in the art can obviously make various equivalent modifications or changes according to the above examples given, for example, some steps in each of the above detection methods can be unnecessary, or some steps can be newly added, etc. Or a combination of any two or more embodiments. Such modifications, changes or combinations also fall within the scope of the embodiments of the present application.

[0266] It should also be understood that the above description of the embodiments of the present application focuses on the differences between the various embodiments, and the same or similar parts not mentioned can be referred to each other, and for the sake of brevity, will not be repeated here.

[0267] It should also be understood that the size of the serial number of each process described above does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0268] It should also be understood that in the embodiments of the present application, "previously set" and "previously defined" can be achieved by previously saving the corresponding code, table or other means for indicating relevant information in the device (for example, including electronic devices), and the present application does not limit the specific implementation manner thereof.

[0269] It should also be understood that the division of the modes, cases, categories and embodiments in the embodiments of the present application is only for the convenience of description, and should not constitute a special limitation. The features in various modes, categories, cases and embodiments can be combined without contradiction.

[0270] It should also be understood that in various embodiments of the present application, the terms and / or descriptions of different embodiments are consistent and can be mutually referred to if there is no special description and logical conflict. The technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationship.

[0271] Finally, it should be noted that the above description is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto. Any change or replacement within the technical scope disclosed in the present application should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of adjusting a heartbeat cycle, characterized by, The method is applied to an IoT platform, and the method comprises: when the system time of the IoT platform reaches the start time of the i th execution period of a heartbeat period adjustment task, determining a basic heartbeat period corresponding to the i th execution period according to the time when an IoT device is registered to the IoT platform and the period length of the i th execution period, i being a positive integer; determining a user activity index of a target period in the i-1 th execution period, the user activity index being in a positive proportional relationship with the number of times of occurrence of a target event in the target period in the i-1 th execution period; adjusting the basic heartbeat period corresponding to the i th execution period according to the user activity index to obtain a heartbeat period of the target period in the i th execution period, the target period being any one of M periods included in the i-1 th execution period and the i th execution period respectively, M being a positive integer; sending an instruction to the IoT device, the instruction comprising the heartbeat period of each period in the i th execution period, the heartbeat period of each period being used to instruct the IoT device to send a heartbeat packet to the IoT platform at a time interval in each period; wherein the target event comprises at least one of the following: a first event, the first event being an event in which a user device controls the IoT device through the IoT platform; a second event, the second event being an event in which an IoT application of the user device switches to a foreground running state, the IoT application being used to control the IoT device; a third event, the third event being an event in which the IoT device reports collected data to the IoT platform; and a fourth event, the fourth event being an offline event of the IoT device.

2. The method of claim 1, wherein, Each execution period of the heartbeat period adjustment task corresponds to a preset basic heartbeat period respectively. The basic heartbeat period corresponding to the i-1 th execution period is less than or equal to the basic heartbeat period corresponding to the i th execution period.

3. The method of claim 1, wherein, The i-1 th execution period and the i th execution period respectively comprise N sub-periods, and each of the N sub-periods comprises M sub-periods; the target period is a j th period in the M periods, the j th period comprising a j th sub-period of each sub-period; wherein N is a positive integer, and j is a positive integer less than or equal to M.

4. The method of claim 1, wherein, The determination of the user activity index of the target period in the i-1 th execution period comprises: obtaining a first user activity index according to the number of times of occurrence of the first event in the target period in the i-1 th execution period; obtaining a second user activity index according to the number of times of occurrence of the second event in the target period in the i-1 th execution period; obtaining a third user activity index according to the number of times of occurrence of the third event in the target period in the i-1 th execution period; obtaining a fourth user activity index according to the number of times of occurrence of the fourth event in the target period in the i-1 th execution period; The user activity index includes the first user activity index, the second user activity index, the third user activity index, and the fourth user activity index.

5. The method of claim 4, wherein, The adjusting the base heartbeat period corresponding to the i th execution period according to the user activity index comprises: According to the first user activity index, the second user activity index, the third user activity index and the fourth user activity index, a heartbeat period of the target period in the i-th execution cycle is calculated by using the following equation : wherein, denotes a base heartbeat period corresponding to the i-th execution period, denotes the first user activity index, denotes the second user activity index, denotes the third user activity index, denotes the fourth user activity index, denotes a weight coefficient corresponding to the first event, denotes a weight coefficient corresponding to the second event, denotes a weight coefficient corresponding to the third event, denotes a weight coefficient corresponding to the fourth event.

6. The method according to any one of claims 1 to 5, characterized in that, The method further comprises: In the i-1 th execution period, receiving first data and second data from the user equipment, the first data indicating the first event, and the second data indicating the second event; In the i-1 th execution period, receiving third data and fourth data from the IoT equipment, the third data indicating the third event, and the fourth data indicating the fourth event.

7. The method according to any one of claims 1 to 5, characterized in that, The i-1 th execution period comprises N sub-periods, and each of the N sub-periods comprises M sub-periods; the target period is a j th period of the M periods, and the j th period comprises a j th sub-period of each of the sub-periods; N is a positive integer, and j is a positive integer less than or equal to M; The acquiring the number of times of occurrence of the target event in the target period of the i-1 th execution period comprises: For each type of event of the target event, if the number of times of occurrence of each type of event in the j th sub-period of any one of the sub-periods of the i-1 th execution period is greater than or equal to 1, then 1 is marked; The number of times of occurrence of each type of event in the target period of the i-1 th execution period is obtained by accumulating and summing the number of times of marking of the j th sub-period of the N sub-periods of the i-1 th execution period.

8. The method according to any one of claims 1 to 5, characterized in that, Before the system time of the IoT platform reaches the start time of the i th execution period of the heartbeat period adjustment task, the method further comprises: receiving a registration request message from the IoT equipment; in response to the registration request message, verifying that the IoT equipment is a legal device; creating the heartbeat period adjustment task, and sending a successful registration message to the IoT equipment; The heartbeat period adjustment task is to take the time when the IoT equipment is registered to the IoT platform as the start time, and calculate the heartbeat period of the IoT equipment once in each execution period.

9. The method of claim 8, wherein, The length of each execution period is determined according to at least one of the following: the device type of the IoT equipment, and the number of devices registered to the IoT platform.

10. The method according to any one of claims 1 to 5, characterized in that, After sending the instruction to the IoT equipment, the method further comprises: if a heartbeat packet is received from the IoT equipment within a preset time, it is determined that the IoT equipment is in an online state, and a heartbeat response is sent to the IoT equipment; or, if no heartbeat packet is received from the IoT equipment within a preset time, it is determined that the IoT equipment is in an offline state, and the connection between the IoT platform and the IoT equipment is released; The heartbeat packet and the heartbeat response are used to maintain the long connection between the IoT equipment and the IoT platform.

11. An IoT platform, characterized in that, The IoT platform comprises a communication interface, a processor and a memory, the processor is coupled with the memory, the communication interface is used for connecting the IoT device and the user equipment, and the processor is used for executing the computer program or instruction stored in the memory, so that the IoT platform implements the heartbeat period adjustment method according to any one of claims 1 to 10.

12. A chip, characterized by The chip is coupled with the memory, and the chip is used for reading and executing the computer program stored in the memory, so as to implement the heartbeat period adjustment method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program runs on the IoT platform, the IoT platform executes the heartbeat period adjustment method according to any one of claims 1 to 10.

Citation Information

Patent Citations

  • Communication method and device and computer readable storage medium

    CN111698098A