Current-taking methods, low-power battery devices, clients, current-taking systems and devices
By using the MCU module to establish a long connection with the client in a low-power battery device, and awakening the CPU module to directly send code stream data, the problem of long and low efficiency of stream fetching in the existing technology is solved, and more efficient stream fetching is achieved flow process and reduced flow cost.
Patent Information
- Application Number
- CN202111520918.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-13
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2041-12-13
AI Technical Summary
The existing low-power battery equipment consumes time and is inefficient in the flow extraction process, and increases the traffic cost of the cloud platform.
The first long connection is established between the MCU module in the low-power battery device and the client. After receiving the client's stream fetch request, the CPU module is awakened and the target code stream data is directly sent to the client through the CPU module, avoiding the cloud Data transfer of the platform.
It reduces the time-consuming process of flow fetching, improves flow fetching efficiency, and reduces the traffic forwarding cost of cloud platforms.
Smart Images

Figure CN114222062B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a flow acquisition method, a low-power battery device, a client, a flow acquisition system and a device. Background Art
[0002] With the development of science and technology, video surveillance technology has made great progress, and Internet surveillance camera devices that provide real-time preview functions are becoming more and more popular. At present, in order to avoid the trouble of connecting to the power cord, some surveillance cameras use low-power battery technology. In order to save energy as much as possible, this low-power battery device is generally in a dormant state. Only when the actual business is triggered, it will enter the wake-up process and then process the corresponding request.
[0003] When sending a stream request to a low-power battery device, the existing processing method is to wake up the central processing unit (CPU) module, and then the device pushes the real-time code stream to the cloud platform, which then forwards it to the client, which then receives it and displays it. This stream acquisition method increases transmission time and also increases the traffic cost of the cloud platform. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a flow acquisition method, a low-power battery device, a client, a flow acquisition system and a device, so as to solve the problem that the flow acquisition method of the existing low-power battery device takes a long time to acquire the flow and has low flow acquisition efficiency.
[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows:
[0006] On the one hand, an embodiment of the present application provides a flow acquisition method, which is applied to a low-power battery device, wherein the low-power battery device includes a microcontroller MCU module and a central processing unit CPU module, and a first long connection is established between the MCU module and the client; the method includes:
[0007] Receiving a stream acquisition request sent by the client through the first long connection established between the MCU module and the client;
[0008] The CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is transmitted to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request;
[0009] The target code stream data corresponding to the stream acquisition request is sent to the client through the CPU module.
[0010] On the other hand, an embodiment of the present application provides a method for obtaining a stream, which is applied to a client, and the method includes:
[0011] Sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client;
[0012] Receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request;
[0013] Wherein, the low-power battery device includes the MCU module and the CPU module.
[0014] On the other hand, an embodiment of the present application provides a low-power battery device, including:
[0015] The MCU module is used to establish a first long connection with the client; and receive a stream acquisition request sent by the client through the first long connection;
[0016] The MCU module is further used to wake up the CPU module and transmit the long connection information corresponding to the first long connection to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request;
[0017] The CPU module is used to send the target code stream data corresponding to the stream acquisition request to the client.
[0018] On the other hand, an embodiment of the present application provides a client, including:
[0019] A sending module, used for sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client;
[0020] A receiving module, used for receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request;
[0021] Wherein, the low-power battery device includes the MCU module and the CPU module.
[0022] On the other hand, an embodiment of the present application provides a flow acquisition system, including a low-power battery device and a client; wherein the low-power battery device includes an MCU module and a CPU module;
[0023] The low-power battery device is used to establish a first long connection with the client through the MCU module;
[0024] The client is used to send a stream acquisition request to the MCU module through the first long connection;
[0025] The low-power battery device is further used to receive the stream acquisition request sent by the client; wake up the CPU module through the MCU module, and transmit the long connection information corresponding to the first long connection to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request; send the target code stream data corresponding to the stream acquisition request to the client through the CPU module;
[0026] The client is also used to receive the target code stream data sent by the CPU module.
[0027] On the other hand, an embodiment of the present application provides a flow acquisition device, including a processor and a memory electrically connected to the processor, the memory storing a computer program, and the processor being used to call and execute the computer program from the memory to implement the flow acquisition method described above.
[0028] On the other hand, an embodiment of the present application provides a storage medium, which is used to store a computer program. When the computer program is executed by a processor, it implements the above-mentioned stream acquisition method.
[0029] By adopting the technical solution of the embodiment of the present invention, the low-power battery device receives the stream acquisition request sent by the client through the first long connection established between the MCU module therein and the client. Then the CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is passed to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request. Then, the target stream data corresponding to the stream acquisition request is sent to the client through the CPU module. It can be seen that the technical solution completes the stream acquisition process through the long connection established between the low-power battery device and the client, eliminating the forwarding link of data transfer by the cloud platform during the stream acquisition process, thereby reducing the time consumption of the stream acquisition process, improving the stream acquisition efficiency, and also reducing the traffic forwarding cost of the cloud platform. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 is a schematic flow chart of a flow acquisition method according to an embodiment of the present invention;
[0032] Figure 2 is a schematic flow chart of establishing a first long connection in a flow acquisition method according to an embodiment of the present invention;
[0033] Figure 3 is a schematic flow chart of a flow acquisition method according to another embodiment of the present invention;
[0034] Figure 4 is a schematic flow chart of a flow acquisition method according to another embodiment of the present invention;
[0035] Figure 5 is a schematic block diagram of a low power consumption battery device according to an embodiment of the present invention;
[0036] Figure 6 is a schematic block diagram of a client according to an embodiment of the present invention;
[0037] Figure 7 is a schematic block diagram of a flow extraction system according to an embodiment of the present invention;
[0038] Figure 8 is a schematic block diagram of a flow acquisition device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The embodiments of the present application provide a flow acquisition method, a low-power battery device, a client, a flow acquisition system and a device, which are used to solve the problems of long flow acquisition time and low flow acquisition efficiency in the existing low-power battery device flow acquisition method.
[0040] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0041] The flow extraction method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0042] Figure 1is a schematic flow chart of a method for obtaining a flow according to an embodiment of the present invention. In this embodiment, the method for obtaining a flow is applied to a low-power battery device, and the low-power battery device includes a microcontroller unit (MCU) module and a central processing unit (CPU) module, and a first long connection is established between the MCU module and the client. Figure 1 As shown, the method includes the following steps S102-S106:
[0043] S102, receiving a stream acquisition request sent by the client through a first long connection established between the MCU module and the client.
[0044] The MCU module is a single-chip microcomputer chip with basic network operations, memory, data reading and writing, and low-function computing capabilities. The first long connection can be a data transmission channel established between the MCU module and the client based on peer-to-peer (P2P) hole punching technology. The client can be an electronic device such as a mobile phone, a tablet computer, or a smart wearable device.
[0045] S104, waking up the CPU module through the MCU module, and transmitting the long connection information corresponding to the first long connection to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request.
[0046] Among them, in order to reduce the energy consumption of the device, low-power battery devices will uniformly deploy high-energy consumption modules such as information processing or program running in the CPU module, and put the basic device access module into the MCU module. The CPU module is in a dormant state before the MCU module receives a request for flow acquisition, that is, in a low-power state. After the CPU module is awakened by the MCU module, the CPU module switches from the dormant state to the working state.
[0047] S106, sending the target code stream data corresponding to the stream acquisition request to the client through the CPU module.
[0048] For example, in one scenario, the low-power battery device is a monitoring device, and the stream acquisition request can be a request to obtain monitoring video data for a certain period of time or the current real-time, then the corresponding target code stream data is the video data formed by multiple frames of video images in the period of time or the current real-time.
[0049] In this embodiment, the low-power battery device receives the stream acquisition request sent by the client through the first long connection established between the MCU module and the client. The CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is passed to the CPU module. The target stream data corresponding to the stream acquisition request is sent to the client through the CPU module. It can be seen that in this technical solution, the stream acquisition process is completed by establishing a long connection between the low-power battery device and the client, which eliminates the forwarding link of data transfer by the cloud platform during the stream acquisition process, thereby reducing the time consumption of the stream acquisition process, improving the stream acquisition efficiency, and also reducing the traffic forwarding cost of the cloud platform.
[0050] In one embodiment, the long connection information corresponding to the first long connection includes at least one of the long connection information of the first end of the low-power battery device, the long connection information of the second end of the client, and the long connection identification information corresponding to the first long connection. The first-end long connection information includes at least one of the local Internet Protocol (IP) address and local port information of the low-power battery device, the external IP address and the external port information. The second-end long connection information includes at least one of the local IP address and local port information of the client, the external IP address and the external port information.
[0051] In this embodiment, the long connection information corresponding to the first long connection is transmitted to the CPU module through the MCU module, so that the CPU module can establish a second long connection with the client according to the first long connection information, thereby ensuring that the client is the connection object for establishing the second long connection with the CPU module, and at the same time improving the efficiency of establishing the second long connection between the CPU module of the low-power battery device and the client.
[0052] In one embodiment, before executing S102, a first long connection is pre-established between the MCU module of the low-power battery device and the client. The method for establishing the first long connection is described in detail below.
[0053] Figure 2 FIG. 1 is a schematic flow chart of establishing a first long connection in a method for acquiring a stream according to an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S201-S208:
[0054] S201, the client logs in to the cloud platform and obtains device information of the low-power battery device through the cloud platform.
[0055] Among them, the low-power battery device maintains a two-way long connection with the cloud platform through the MCU module. The device information of the low-power battery device may include the unique identification information of the low-power battery device and the online status information of the low-power battery device. After the client obtains the unique identification information and confirms that the low-power battery device is online, it starts to penetrate the low-power battery device.
[0056] S202, the client sends a point-to-point penetration request to the cloud platform.
[0057] Specifically, the client opens a new local User Datagram Protocol (UDP) port, creates a UDP socket, and uses this socket to obtain the external IP and port information corresponding to the local UDP port through the Session Traversal Utilities for NAT (STUN) service. The client then generates a unique identification ID corresponding to this penetration request, and assembles the client's local IP and port information, the corresponding external IP and port information, and the unique identification ID corresponding to this penetration request into a penetration request based on the communication protocol between the client and the cloud platform, and sends it to the cloud platform.
[0058] S203, after receiving the penetration request sent by the client, the cloud platform sends the penetration request to the MCU module of the low-power battery device.
[0059] S204, after receiving the penetration request, the MCU module of the low-power battery device sends a penetration response to the cloud platform.
[0060] Specifically, after the MCU module of the low-power battery device receives the penetration request, the MCU module opens a new local UDP port, creates a UDP socket, and uses this socket to obtain the external IP and port information corresponding to the local UDP port through the STUN service. After that, the MCU module will assemble its own local IP and port information and the corresponding external IP and port information into a penetration response and send it to the cloud platform. At the same time, the MCU module will record the local IP and port information of the client of this penetration request, the corresponding external IP and port information, and the unique identification ID corresponding to this penetration request.
[0061] S205, the MCU module of the low-power battery device sends a penetration packet to the client.
[0062] Among them, the penetration packet carries the unique identification ID corresponding to this penetration request. Specifically, the MCU module obtains the client's local IP and port information and the corresponding external network IP and port information according to the received penetration request. Considering that the low-power battery device and the client may be in the same LAN or in different LANs, when the MCU module sends a penetration packet to the client, it will simultaneously send multiple penetration packets to the client's local IP and port, as well as multiple penetration packets to the client's external network IP and port.
[0063] S206, after receiving the penetration response, the cloud platform sends the penetration response to the client.
[0064] S207, after receiving the penetration response, the client sends a penetration packet to the MCU module of the low-power battery device.
[0065] The penetration packet carries the unique identification ID corresponding to this penetration request. Specifically, the client obtains the local IP and port information of the MCU module and the corresponding external IP and port information according to the received penetration response. When the client sends a penetration packet to the MCU module, it will simultaneously send multiple penetration packets to the local IP and port of the MCU module, as well as multiple penetration packets to the external IP and port of the MCU module.
[0066] S208, after receiving the penetration packet sent by the other party, the MCU modules of the client and the low-power battery device consider that the penetration is successful, and the first long connection is established.
[0067] In this embodiment, a first long connection is pre-established between the MCU module of the low-power battery device and the client through point-to-point hole punching technology, so that when the client sends a flow request to the low-power battery device, it is no longer necessary to transfer the flow request through the cloud platform. The flow request can be directly transmitted to the low-power battery device through the first long connection, thereby improving the transmission efficiency of the flow request and reducing the time of the flow acquisition process.
[0068] In one embodiment, after the MCU module wakes up the CPU module and transmits the long connection information corresponding to the first long connection to the CPU module, the CPU module sends the target code stream data corresponding to the stream acquisition request to the client, which can be specifically implemented by the following steps A1-A2:
[0069] Step A1: Establish a second long connection between the CPU module and the client according to the long connection information.
[0070] Optionally, the second long connection is: the CPU module establishes a data transmission channel between the CPU module and the client according to the local IP address and local port information of the low-power battery device in the long connection information, and the IP and port information of the successful penetration with the client. The IP and port information of the successful penetration with the client may be the local IP address and local port information, or the external network IP address and external network port information.
[0071] Step A2: Send the target code stream data corresponding to the stream acquisition request to the client through the second long connection.
[0072] For example, in one scenario, the low-power battery device is a monitoring device, and the stream acquisition request can be a request to obtain monitoring video data for a certain period of time or the current real-time, then the corresponding target code stream data is the video data formed by multiple frames of video images in the period of time or the current real-time.
[0073] In this embodiment, a second long connection is established between the CPU module and the client, and then the target code stream data is sent to the client through the second long connection, so that the low-power battery device directly transmits the target code stream data to the client, reducing the forwarding link of data transfer by the cloud platform, thereby reducing the time consumption of transmitting the target code stream data to the client, and also reducing the traffic forwarding cost of the cloud platform.
[0074] In one embodiment, after the MCU module establishes the first long connection with the client, before the client sends a stream acquisition request to the MCU module through the first long connection, there may be no data transmission in the first long connection for a long period of time. In this case, the first long connection may be abnormally disconnected, for example, the process where the first long connection is located is killed, the network status changes, the intermediate network link is abnormal, etc. In order to keep the first long connection alive and confirm whether the first long connection is still connected, a heartbeat mechanism can be used to maintain the first long connection. Optionally, the low-power battery device maintaining the first long connection through the heartbeat mechanism can include steps B1-B2:
[0075] Step B1: Receive the first heartbeat packet sent by the client through the MCU module.
[0076] Among them, the first heartbeat packet is sent by the client to the MCU module according to the first preset sending frequency. The first preset sending frequency is a sending frequency preset by the client. For example, it can be set to send a first heartbeat packet to the MCU module every 10 seconds.
[0077] Step B2, determine whether the first heartbeat packet is received within a first preset time length, and / or determine whether the consecutive number of unsuccessful reception of the first heartbeat packet is less than or equal to a first preset threshold; if so, determine that the first long connection remains connected; if not, determine that the first long connection is disconnected.
[0078] Wherein, the first preset threshold value is the maximum value of the consecutive number of unsuccessful reception of the first heartbeat packet that is preset. For example, the first preset duration can be set to 20 seconds, the first preset threshold value can be 2, and the first preset transmission frequency of the client is once every 10 seconds. When the MCU module has received the first heartbeat packet sent by the client within 20 seconds and the consecutive number of times that the MCU module has not successfully received the first heartbeat packet is less than or equal to 2, it can be determined that the first long connection established between the MCU module and the client remains connected. In addition, if the MCU module has received the first heartbeat packet sent by the client within 20 seconds or the consecutive number of times that the MCU module has not successfully received the first heartbeat packet is less than or equal to 2, it can also be determined that the first long connection established between the MCU module and the client remains connected. When the MCU module has not received the first heartbeat packet sent by the client within 20 seconds and the consecutive number of times that the MCU module has not successfully received the first heartbeat packet is greater than 2, it is determined that the first long connection established between the MCU module and the client is disconnected. In addition, if the MCU module has not received the first heartbeat packet sent by the client within 20 seconds or the MCU module has failed to successfully receive the first heartbeat packet for more than 2 consecutive times, it can also be determined that the first long connection established between the MCU module and the client is disconnected.
[0079] In this embodiment, the heartbeat mechanism is used to maintain the liveness of the first long connection and confirm whether the first long connection is still connected. On the one hand, the connection status of the client can be monitored to ensure the real-time performance of the first long connection. On the other hand, the first long connection can be prevented from being released by an intermediate node (such as NAT), thereby achieving the purpose of keeping the first long connection alive.
[0080] Figure 3 is a schematic flow chart of a flow acquisition method according to another embodiment of the present invention, such as Figure 3 As shown, the method is applied to the client, comprising the following steps S302-S304:
[0081] S302, sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client.
[0082] The MCU module is a single-chip microcomputer chip with basic network operations, memory, data reading and writing, and low-function computing capabilities. The first long connection can be a data transmission channel established between the MCU module and the client based on peer-to-peer (P2P) hole punching technology. The client can be an electronic device such as a mobile phone, a tablet computer, or a smart wearable device.
[0083] S304, receiving the target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request; wherein the low-power battery device includes the MCU module and the CPU module.
[0084] For example, in one scenario, the low-power battery device is a monitoring device, and the stream acquisition request can be a request to obtain monitoring video data for a certain period of time or the current real-time, then the corresponding target code stream data is the video data formed by multiple frames of video images in the period of time or the current real-time.
[0085] In this embodiment, a stream acquisition request is sent to the MCU module through the first long connection established between the MCU module in the low-power battery device and the client. The target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device is received, and the process of completing the stream acquisition through the long connection established with the low-power battery device is realized, eliminating the forwarding link of data transfer by the cloud platform during the stream acquisition request process, thereby reducing the time consumption of the stream acquisition process, improving the stream acquisition efficiency, and also reducing the traffic forwarding cost of the cloud platform.
[0086] In one embodiment, after the client sends a stream acquisition request to the MCU module of the low-power battery device through the first long connection, the low-power battery device wakes up the CPU module through the MCU module and transmits the long connection information corresponding to the first long connection to the CPU module. The CPU module establishes a second long connection between the CPU module and the client based on the local IP address and local port information of the low-power battery device in the first long connection information, as well as the IP and port information that successfully penetrates the client. The CPU module sends the target code stream data to the client through the second long connection. Among them, the IP and port information that successfully penetrates the client may be the local IP address and local port information, or the external network IP address and external network port information. The client receives the target code stream data sent by the CPU module through the second long connection.
[0087] In this embodiment, the target code stream data sent by the low-power battery device is received through the second long connection established between the CPU module of the low-power battery device and the client, which reduces the forwarding link transferred by the cloud platform, thereby reducing the time consumed by the client to obtain the target code stream data, and also reduces the traffic forwarding cost of the cloud platform.
[0088] In one embodiment, after the client establishes the first long connection with the MCU module, before the client sends a stream acquisition request, there may be no data transmission in the first long connection for a long period of time. In this case, the first long connection may be abnormally disconnected, for example, the process where the first long connection is located is killed, the network status changes, the intermediate network link is abnormal, etc. In order to maintain the first long connection alive and confirm whether the first long connection is still connected, a heartbeat mechanism can be used to maintain the first long connection. Optionally, the client maintaining the first long connection through the heartbeat mechanism can include steps C1-C2:
[0089] Step C1: receiving a second heartbeat packet sent by the MCU module through the first long connection.
[0090] Among them, the second heartbeat packet is sent to the client by the MCU module of the low-power battery device according to the second preset sending frequency. The second preset sending frequency is the sending frequency preset by the MCU module of the low-power battery. For example, it can be set to send a second heartbeat packet to the client every 10 seconds.
[0091] Step C2, determining whether the second heartbeat packet is received within a second preset time length, and / or determining whether the consecutive number of unsuccessful reception of the second heartbeat packet is less than or equal to a second preset threshold; if so, determining that the first long connection remains connected; if not, determining that the first long connection is disconnected.
[0092] Among them, the second preset threshold value is the maximum value of the consecutive number of unsuccessful reception of the second heartbeat packet that is preset. For example, the second preset duration can be set to 20 seconds, the second preset threshold value can be 2, and the second preset transmission frequency of the MCU module of the low-power battery device is once every 10 seconds. When the client receives the second heartbeat packet sent by the MCU module within 20 seconds and the consecutive number of times that the client fails to successfully receive the second heartbeat packet is less than or equal to 2, it can be determined that the first long connection established between the MCU module and the client remains connected. In addition, if the client receives the second heartbeat packet sent by the MCU module within 20 seconds or the consecutive number of times that the client fails to successfully receive the second heartbeat packet is less than or equal to 2, it can also be determined that the first long connection remains connected. When the client has not received the second heartbeat packet sent by the MCU module within 20 seconds and the consecutive number of times that the MCU module fails to successfully receive the second heartbeat packet is greater than 2, it is determined that the first long connection established between the MCU module and the client is disconnected. In addition, if the client has not received the second heartbeat packet sent by the MCU module within 20 seconds or the consecutive number of times that the MCU module fails to successfully receive the second heartbeat packet is greater than 2, it is determined that the first long connection established between the MCU module and the client is disconnected.
[0093] In this embodiment, the heartbeat mechanism is used to maintain the liveness of the first long connection and confirm whether the first long connection is still connected. On the one hand, the connection status of the low-power battery device can be monitored, so that the client can determine whether the first long connection is still connected before sending a stream acquisition request, thereby ensuring the real-time performance of the first long connection. On the other hand, the first long connection can be prevented from being released by an intermediate node (such as NAT), thereby achieving the purpose of keeping the first long connection alive.
[0094] Figure 4 FIG. 1 is a schematic flow chart of a method for obtaining a flow according to another embodiment of the present invention. In this embodiment, the method for obtaining a flow is applied to a low-power battery device and a client, and the low-power battery device includes an MCU module and a CPU module. Figure 3 As shown, the method may include the following steps S401-S407:
[0095] S401, a first long connection is established between the MCU module of the low-power battery device and the client.
[0096] S402, the MCU module of the low-power battery device and the client send heartbeat packets to each other to maintain the first long connection alive.
[0097] Among them, the specific method in which the MCU module and the client send heartbeat packets to each other to maintain the first long connection alive has been described in detail in the above embodiment and will not be repeated here.
[0098] S403, the client determines whether the first long connection is successfully established; if so, execute S404; if not, execute S401.
[0099] Among them, the specific method for the client to determine whether the first long connection is successfully established has been described in detail in the above embodiment and will not be repeated here. Optionally, when the result of the client determining whether the first long connection is successfully established is no, the client can also send a stream acquisition request to the cloud platform so that the cloud platform can forward the stream acquisition request to the MCU module of the low-power battery device.
[0100] S404: The client sends a stream acquisition request to the MCU module of the low-power battery device through the first long connection.
[0101] For example, in one scenario, the low-power battery device is a monitoring device, and the stream acquisition request may be a request for acquiring monitoring video data of a certain period of time or current real-time.
[0102] S405: The MCU module of the low-power battery device wakes up the CPU module and transmits the long connection information corresponding to the first long connection to the CPU module.
[0103] Among them, in order to reduce the energy consumption of the device, low-power battery devices will uniformly deploy high-energy consumption modules such as information processing or program running in the CPU module, and put the basic device access module into the MCU module. The CPU module is in a dormant state before the MCU module receives a request for flow acquisition, that is, in a low-power state. After the CPU module is awakened by the MCU module, the CPU module switches from the dormant state to the working state.
[0104] The long connection information corresponding to the first long connection includes at least one of the first-end long connection information of the low-power battery device, the second-end long connection information of the client, and the long connection identification information corresponding to the first long connection. Among them, the first-end long connection information includes at least one of the local IP address and local port information of the low-power battery device, the external network IP address and the external network port information. The second-end long connection information includes at least one of the local IP address and local port information of the client, the external network IP address and the external network port information.
[0105] S406: The CPU module establishes a second long connection between the CPU module and the client according to the long connection information.
[0106] The specific method by which the CPU module establishes the second long connection between the CPU module and the client according to the long connection information has been described in detail in the above embodiment and will not be repeated here.
[0107] S407: The CPU module sends the target code stream data to the client through the second long connection.
[0108] For example, in one scenario, the low-power battery device is a monitoring device, and the stream acquisition request can be a request to obtain monitoring video data for a certain period of time or the current real-time, then the corresponding target code stream data is the video data formed by multiple frames of video images in the period of time or the current real-time.
[0109] In this embodiment, a first long connection is pre-established between the MCU module of the low-power battery device and the client, and the client sends a stream acquisition request to the low-power battery device through the first long connection. After the low-power battery device receives the stream acquisition request through the first long connection, it establishes a second long connection with the client, and sends the target code stream data to the client through the second long connection. In this technical solution, the stream acquisition process is completed through a long connection established between the low-power battery device and the client, eliminating the forwarding link of data transfer by the cloud platform during the stream acquisition process, thereby reducing the time consumption of the stream acquisition process, improving the stream acquisition efficiency, and also reducing the traffic forwarding cost of the cloud platform.
[0110] The above is a current acquisition method provided in an embodiment of the present application. Based on the same idea, an embodiment of the present application also provides a low-power battery device.
[0111] Figure 5 is a schematic block diagram of a low power consumption battery device according to an embodiment of the present invention. Figure 5 As shown, the low power consumption battery device includes:
[0112] The MCU module 510 is configured to establish a first persistent connection with a client and receive a stream acquisition request sent by the client through the first persistent connection;
[0113] The MCU module 510 is further used to wake up the CPU module 520 and transmit the long connection information corresponding to the first long connection to the CPU module 520; wherein the CPU module 520 is in a dormant state before the MCU module 510 receives the stream acquisition request;
[0114] The CPU module 520 is used to send the target code stream data corresponding to the stream acquisition request to the client.
[0115] Optionally, the long connection information includes at least one of first-end long connection information of the low-power battery device, second-end long connection information of the client, and long connection identification information corresponding to the first long connection;
[0116] The first-end long connection information includes at least one of the local Internet Protocol IP address and local port information, the external IP address and the external port information of the low-power battery device; the second-end long connection information includes at least one of the local IP address and local port information, the external IP address and the external port information of the client.
[0117] Optionally, the CPU module 520 is further used for:
[0118] Establishing a second long connection between the CPU module 520 and the client according to the long connection information;
[0119] The target code stream data is sent to the client through the second long connection.
[0120] Optionally, the CPU module 520 is further used for:
[0121] A second long connection is established between the CPU module 520 and the client according to the local IP address and / or the local port information of the low-power battery device and the external network IP address and / or the external network port information of the client.
[0122] Optionally, the MCU module 410 is further used for:
[0123] Receive a first heartbeat packet sent by the client; the first heartbeat packet is sent by the client to the MCU module 510 according to a first preset sending frequency;
[0124] Determine whether the first heartbeat packet is received within a first preset time length, and / or determine whether the consecutive number of unsuccessful reception of the first heartbeat packet is less than or equal to a first preset threshold;
[0125] If so, it is determined that the first long connection remains connected; if not, it is determined that the first long connection is disconnected.
[0126] In this embodiment, the low-power battery device receives the stream acquisition request sent by the client through the first long connection established between the MCU module and the client. The CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is passed to the CPU module. The target stream data corresponding to the stream acquisition request is sent to the client through the CPU module. It can be seen that in this technical solution, the stream acquisition process is completed by establishing a long connection between the low-power battery device and the client, which eliminates the forwarding link of the cloud platform in the process of stream acquisition, thereby reducing the time consumption of the stream acquisition process, improving the efficiency of stream acquisition, and also reducing the traffic forwarding cost of the cloud platform.
[0127] The above is a low-power battery device provided in an embodiment of the present application. Based on the same idea, an embodiment of the present application also provides a client.
[0128] Figure 6 is a schematic block diagram of a client according to an embodiment of the present invention, such as Figure 6 As shown, the client includes:
[0129] A sending module 610, configured to send a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client;
[0130] The receiving module 620 is used to receive the target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request;
[0131] Wherein, the low-power battery device includes the MCU module and the CPU module.
[0132] Optionally, the receiving module 620 is further configured to:
[0133] The target code stream data sent by the CPU module is received through a second long connection established between the CPU module and the client; the second long connection is established after the CPU module is awakened.
[0134] Optionally, the sending module 610 is further configured to:
[0135] Establishing the first long connection between the MCU module and the client;
[0136] The sending a stream acquisition request to the MCU module includes:
[0137] Determining whether the first long connection is successfully established;
[0138] If so, the stream acquisition request is sent to the MCU module through the first long connection.
[0139] Optionally, the sending module 610 is further configured to:
[0140] Receiving a second heartbeat packet sent by the MCU module through the first long connection; the second heartbeat packet is sent by the MCU module to the client according to a second preset sending frequency;
[0141] Determine whether the second heartbeat packet is received within a second preset time length; and / or, determine whether the consecutive number of unsuccessful reception of the second heartbeat packet is less than or equal to a second preset threshold;
[0142] If so, it is determined that the first long connection remains connected; if not, it is determined that the first long connection is disconnected.
[0143] In this embodiment, the sending module sends a stream acquisition request to the MCU module through the first long connection established between the MCU module in the low-power battery device and the client. The receiving module receives the target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device, and realizes the process of completing the stream acquisition through the long connection established with the low-power battery device, reducing the forwarding link of data transfer by the cloud platform during the stream acquisition process, thereby reducing the time consumption of the stream acquisition process, improving the stream acquisition efficiency, and also reducing the traffic forwarding cost of the cloud platform.
[0144] Those skilled in the art should understand that Figure 5 Low power battery devices and Figure 6 The client in can be used to implement the streaming method described above, and the detailed description should be similar to the description of the method part above. To avoid tediousness, it will not be repeated here.
[0145] The above is a client provided in an embodiment of the present application. Based on the same idea, an embodiment of the present application also provides a flow acquisition system.
[0146] Figure 7 is a schematic block diagram of a flow acquisition system according to an embodiment of the present invention. Figure 7As shown, the flow acquisition system includes: a low-power battery device 710 and a client 720; wherein the low-power battery device 710 includes an MCU module 711 and a CPU module 712.
[0147] The low-power battery device 710 is used to establish a first long connection with the client 720 through the MCU module 711;
[0148] The client 720 is used to send a stream acquisition request to the MCU module 711 through the first long connection;
[0149] The low-power battery device 710 is further used to receive the stream acquisition request sent by the client 720; wake up the CPU module 712 through the MCU module 711, and transmit the long connection information corresponding to the first long connection to the CPU module 712; wherein the CPU module 712 is in a dormant state before the MCU module 711 receives the stream acquisition request; send the target code stream data corresponding to the stream acquisition request to the client 720 through the CPU module 712;
[0150] The client 720 is also used to receive the target code stream data sent by the CPU module 712.
[0151] The stream acquisition system provided in this embodiment establishes a first long connection in advance between the MCU module of the low-power battery device and the client. The client sends a stream acquisition request to the low-power battery device through the first long connection. After the low-power battery device receives the stream acquisition request through the first long connection, it establishes a second long connection with the client, and sends the target code stream data to the client through the second long connection. The stream acquisition process is completed through the long connection established between the low-power battery device and the client, which reduces the forwarding link of data transfer by the cloud platform during the stream acquisition process, reduces the time consumption of the stream acquisition process, improves the stream acquisition efficiency, and also reduces the traffic forwarding cost of the cloud platform.
[0152] Those skilled in the art should understand that Figure 7 The flow collection system in can be used to implement the flow collection method described above, and the detailed description thereof should be similar to the description of the method part above. To avoid tediousness, it will not be repeated here.
[0153] Based on the same idea, the present application also provides a flow collection device, such as Figure 8As shown. The flow-taking device may have relatively large differences due to different configurations or performances, and may include one or more processors 801 and memory 802, and one or more storage applications or data may be stored in the memory 802. Among them, the memory 802 can be a short-term storage or a persistent storage. The application stored in the memory 802 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the flow-taking device. Furthermore, the processor 801 can be configured to communicate with the memory 802, and execute a series of computer executable instructions in the memory 802 on the flow-taking device. The flow-taking device may also include one or more power supplies 803, one or more wired or wireless network interfaces 804, one or more input and output interfaces 805, and one or more keyboards 806.
[0154] Specifically in this embodiment, the flow acquisition device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the flow acquisition device, and the one or more programs are configured to be executed by one or more processors, including the following computer executable instructions:
[0155] Receiving a stream acquisition request sent by the client through the first long connection established between the MCU module and the client;
[0156] The CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is transmitted to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request;
[0157] The target code stream data corresponding to the stream acquisition request is sent to the client through the CPU module.
[0158] Specifically in another embodiment, the flow acquisition device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions in the flow acquisition device, and the one or more programs are configured to be executed by one or more processors, including computer executable instructions for performing the following:
[0159] Sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client;
[0160] Receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request;
[0161] Wherein, the low-power battery device includes the MCU module and the CPU module.
[0162] An embodiment of the present application also proposes a storage medium, which stores one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by an electronic device including multiple applications, the electronic device can execute the various processes of the above-mentioned embodiment of a flow acquisition method applied to a low-power battery device, or the electronic device can execute the various processes of the above-mentioned embodiment of a flow acquisition method applied to a client, and can achieve the same technical effect. To avoid repetition, they are not repeated here.
[0163] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0164] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0165] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0166] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0170] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0171] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0172] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0173] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0174] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0175] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A flow extraction method, characterized in that: Applied to a low-power battery device, the low-power battery device includes a microcontroller MCU module and a central processing unit CPU module, and a first long connection is established between the MCU module and the client; the method includes: Receiving a stream acquisition request sent by the client through the first long connection established between the MCU module and the client; The CPU module is awakened by the MCU module, and the long connection information corresponding to the first long connection is transmitted to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request; Sending target code stream data corresponding to the stream acquisition request to the client through the CPU module; The method of sending the target code stream data corresponding to the stream acquisition request to the client through the CPU module includes: establishing a second long connection between the CPU module and the client according to the long connection information; and sending the target code stream data to the client through the second long connection.
2. The method according to claim 1, characterized in that: The long connection information includes at least one of the first end long connection information of the low power battery device, the second end long connection information of the client, and the long connection identification information corresponding to the first long connection; The first-end long connection information includes at least one of the local Internet Protocol IP address and local port information, the external IP address and the external port information of the low-power battery device; the second-end long connection information includes at least one of the local IP address and local port information, the external IP address and the external port information of the client.
3. The method according to claim 2, characterized in that The step of establishing a second long connection between the CPU module and the client according to the long connection information includes: A second long connection is established between the CPU module and the client according to the local IP address and the local port information of the low-power battery device and the external network IP address and the external network port information of the client.
4. The method according to claim 1, characterized in that: Before the first long connection established between the MCU module and the client receives the stream acquisition request sent by the client, the method further includes: Receiving, by the MCU module, a first heartbeat packet sent by the client; the first heartbeat packet is sent by the client to the MCU module according to a first preset sending frequency; Determine whether the first heartbeat packet is received within a first preset time length, and / or determine whether the consecutive number of unsuccessful reception of the first heartbeat packet is less than or equal to a first preset threshold; If so, it is determined that the first long connection remains connected; if not, it is determined that the first long connection is disconnected.
5. A flow extraction method, characterized in that: Applied to a client, the method comprises: Sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client; Receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request; Wherein, the low-power battery device includes the MCU module and the CPU module; The receiving target code stream data corresponding to the stream acquisition request and sent by the CPU module in the low-power battery device includes: receiving the target code stream data sent by the CPU module through a second long connection established between the CPU module and the client; the second long connection is established after the CPU module is awakened.
6. The method according to claim 5, characterized in that Before sending a stream acquisition request to the MCU module through the first long connection established between the MCU module in the low-power battery device and the client, the method further includes: Establishing the first long connection between the MCU module and the client; The sending a stream acquisition request to the MCU module includes: Determining whether the first long connection is successfully established; If so, the stream acquisition request is sent to the MCU module through the first long connection.
7. The method according to claim 6, characterized in that The determining whether the first long connection is successfully established includes: Receiving a second heartbeat packet sent by the MCU module through the first long connection; the second heartbeat packet is sent by the MCU module to the client according to a second preset sending frequency; Determine whether the second heartbeat packet is received within a second preset time length; and / or, determine whether the consecutive number of unsuccessful reception of the second heartbeat packet is less than or equal to a second preset threshold; If so, it is determined that the first long connection remains connected; if not, it is determined that the first long connection is disconnected.
8. A low power consumption battery device, characterized in that: include: The MCU module is used to establish a first long connection with the client; and receive a stream acquisition request sent by the client through the first long connection; The MCU module is further used to wake up the CPU module and transmit the long connection information corresponding to the first long connection to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request; A CPU module is used to send the target code stream data corresponding to the stream acquisition request to the client; The sending the target code stream data corresponding to the stream acquisition request to the client includes: establishing a second long connection between the CPU module and the client according to the long connection information; and sending the target code stream data to the client through the second long connection.
9. A client, characterized in that: include: A sending module, used for sending a stream acquisition request to the MCU module through a first long connection established between the MCU module in the low-power battery device and the client; A receiving module, used for receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device; the CPU module is awakened by the MCU module after receiving the stream acquisition request; Wherein, the low-power battery device includes the MCU module and the CPU module; The receiving target code stream data corresponding to the stream acquisition request sent by the CPU module in the low-power battery device includes: receiving the target code stream data sent by the CPU module through a second long connection established between the CPU module and the client; the second long connection is established after the CPU module is awakened.
10. A flow collection system, characterized in that: It includes a low-power battery device and a client; wherein the low-power battery device includes an MCU module and a CPU module; The low-power battery device is used to establish a first long connection with the client through the MCU module; The client is used to send a stream acquisition request to the MCU module through the first long connection; The low-power battery device is also used to receive the stream acquisition request sent by the client; wake up the CPU module through the MCU module, and transmit the long connection information corresponding to the first long connection to the CPU module; wherein the CPU module is in a dormant state before the MCU module receives the stream acquisition request; send the target code stream data corresponding to the stream acquisition request to the client through the CPU module; the sending of the target code stream data corresponding to the stream acquisition request to the client through the CPU module includes: establishing a second long connection between the CPU module and the client according to the long connection information; sending the target code stream data to the client through the second long connection; The client is also used to receive the target code stream data sent by the CPU module.
11. A flow collection device, characterized in that: It includes a processor and a memory electrically connected to the processor, the memory stores a computer program, and the processor is used to call and execute the computer program from the memory to implement the flow acquisition method as described in any one of claims 1-4, or the processor is used to call and execute the computer program from the memory to implement the flow acquisition method as described in any one of claims 5-7.
12. A storage medium, characterized in that: The storage medium is used to store a computer program, and when the computer program is executed by the processor, it implements the flow acquisition method as described in any one of claims 1-4, or, when the computer program is executed by the processor, it implements the flow acquisition method as described in any one of claims 5-7.
Citation Information
Patent Citations
Portable IP camera and wireless router running method
CN107360362A