Device data transmission method and apparatus, electronic device, and storage medium

By receiving and processing data transmission requests from smart devices in batches, the problem of data loss caused by the storage capacity limitations of smart devices is solved, a stable and unified data transmission scheme is achieved, and maintenance costs are reduced.

CN115002840BActive Publication Date: 2025-12-30SHENZHEN LUMIUNITED TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210423102.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-21
Publication Date
2025-12-30
Estimated Expiration
2042-04-21

AI Technical Summary

Technical Problem

The limited storage capacity of smart devices makes it easy for device data to be lost during transmission, affecting the stability of data transmission between electronic devices and smart devices.

Method used

By sending data access requests to the target device, receiving data packets sent by the target device in batches, determining the sub-data transmission results of each batch based on the data volume of the target data, pre-allocating storage areas to receive and process data, and ensuring that receiving stops after data transmission is completed to avoid data loss.

Benefits of technology

It improves the stability of data transmission between electronic devices and smart devices, reduces maintenance costs, and adapts to the transmission limitations of different models of smart devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115002840B_ABST
    Figure CN115002840B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a device data transmission method and device, electronic device and storage medium, and relate to the technical field of Internet of Things. The method comprises: sending a data access request to a target device, the data access request being used to indicate target data in the target device that is requested to be accessed; receiving a first data packet sent by the target device in response to the data access request, the first data packet being used to indicate a data volume of the target data; receiving at least one second data packet sent by the target device in batches, each second data packet corresponding to sub data of one batch in the target data; and determining a transmission result of the sub data of each batch in the target data based on the data volume of the target data. The embodiments of the present application solve the problem that device data is prone to loss in the transmission process in the related art.
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, in particular, the present application relates to a device data transmission method and device, electronic equipment and storage medium. BACKGROUND

[0002] With the development of Internet of Things technology, the use of smart devices is becoming more and more widespread, prompting the rich models of smart devices to facilitate the use in different application scenarios.

[0003] It can be understood that different models of smart devices will also have different storage capabilities. Taking a smart door lock as an example, a smart door lock with model NRF52840 has 1MB flash memory and 256KB random access memory (RAM), while a smart door lock with model NRF52833 has 512KB flash memory and 125KB random access memory.

[0004] Limited by the storage capacity of the smart device, the smart device itself has transmission limitations, which makes the electronic device and the smart device often cause device data loss when performing large data volume device data transmission, thereby affecting the stability of data transmission between the electronic device and the smart device.

[0005] As can be seen from the above, the problem of easy loss of device data in the transmission process in the related art still needs to be solved. SUMMARY

[0006] The embodiments of the present application provide a device data transmission method and device, electronic equipment and storage medium, which can solve the problem of easy loss of device data in the transmission process in the related art. The technical solution is as follows:

[0007] According to an aspect of an embodiment of the present application, a device data transmission method comprises: sending a data access request to a target device, the data access request being used to indicate target data in the target device requested to be accessed; receiving a first data packet sent by the target device in response to the data access request, the first data packet being used to indicate the data volume of the target data; receiving at least one second data packet sent by the target device in batches, each second data packet corresponding to a batch of sub data in the target data; determining the transmission result of each batch of sub data in the target data based on the data volume of the target data.

[0008] According to an aspect of an embodiment of the present application, an apparatus for device data transmission comprises: a request sending module configured to send a data access request to a target device, the data access request being used to indicate target data in the target device that is requested to be accessed; a first data packet receiving module configured to receive a first data packet sent by the target device in response to the data access request, the first data packet being used to indicate a data amount of the target data; a second data packet receiving module configured to receive at least one second data packet sent by the target device in batches, each second data packet corresponding to sub data of a batch in the target data; and a result determining module configured to determine a transmission result of the sub data of each batch in the target data based on the data amount of the target data.

[0009] In an example embodiment, the apparatus further comprises: a task creating module configured to create a data access task for device data that is accessible in the target device; and a task adding module configured to add the data access task to a task set, so that the data access task is obtained from the task set as the data access request sent to the target device.

[0010] In an example embodiment, the task creating module comprises: an entry displaying unit configured to display a data entry in a data viewing page, the data entry being associated with device data that is accessible in the target device; an entry triggering unit configured to determine a triggered data entry in response to a triggering operation on the data entry in the data viewing page; and a task generating unit configured to generate a data access task corresponding to the triggered data entry.

[0011] In an example embodiment, the task set is a task queue; and the task adding module comprises: a tail adding unit configured to, when the sub data of each batch in the target data is not completely transmitted, configure a task state of the data access task to be a to-be-executed state and add the data access task to a tail of the task queue.

[0012] In an example embodiment, the task set is a task queue; and the apparatus further comprises a request obtaining module, the request obtaining module comprising: a state determining unit configured to determine a task state of a data access task located at a head of the task queue; a state modifying unit configured to, when the determined task state is the to-be-executed state, take the data access task located at the head as the data access request sent to the target device and modify the task state of the data access task located at the head from the to-be-executed state to an executed state; and a head removing unit configured to wait for the data access task in the executed state to be executed completely and remove the data access task in the executed state from the task queue.

[0013] In an example embodiment, the result determining module comprises: a first determining unit configured to determine, based on the received second data packet, a batch to which the currently received one batch of sub-data belongs and a data amount; a second determining unit configured to determine, according to the batch to which the currently received one batch of sub-data belongs and the data amount, data amounts of the currently received batches of sub-data; and a transmission determining unit configured to determine, according to the data amount of the target data, the batch to which the currently received one batch of sub-data belongs, and the data amounts of the currently received batches of sub-data, whether the transmission result indicates that the transmission of the sub-data of each batch in the target data is completed.

[0014] In an example embodiment, the transmission determining unit comprises: a first transmission completion determining sub-unit configured to determine that the transmission result indicates that the transmission of the sub-data of each batch in the target data is completed, if the data amount of the target data is equal to the data amounts of the currently received batches of sub-data; and / or a second transmission completion determining sub-unit configured to determine that the transmission result indicates that the transmission of the sub-data of each batch in the target data is completed, if the batch to which the currently received one batch of sub-data belongs is the last batch.

[0015] In an example embodiment, the transmission determining unit comprises: a first transmission failure determining sub-unit configured to determine that the transmission result indicates that the transmission of the target data fails, if the batch to which the currently received one batch of sub-data belongs is the last batch, but the data amount of the target data is not equal to the data amounts of the currently received batches of sub-data; or a second transmission failure determining sub-unit configured to determine that the transmission result indicates that the transmission of the target data fails, if the batch to which the currently received one batch of sub-data belongs is not the last batch, but the data amount of the target data is equal to the data amounts of the currently received batches of sub-data.

[0016] In an example embodiment, the apparatus further comprises: a resource allocating module configured to allocate, based on the data amount of the target data, a storage area matching the data amount for the target data; and a resource releasing module configured to notify the target device to release the storage resource for the target data, when the sub-data of each batch in the target data is all stored in the storage area.

[0017] According to an aspect of an embodiment of the present application, an electronic device comprises at least one processor, at least one memory, and at least one communication bus, wherein the memory stores a computer program, and the processor reads the computer program in the memory through the communication bus; the computer program is executed by the processor to implement the device data transmission method as described above.

[0018] According to an aspect of the embodiments of the present application, a storage medium has a computer program stored thereon, and the computer program is executed by a processor to implement the device data transmission method.

[0019] According to an aspect of the embodiments of the present application, a computer program product includes a computer program stored in a storage medium, and a processor of a computer device reads the computer program from the storage medium, and the processor executes the computer program to enable the computer device to implement the device data transmission method.

[0020] The technical scheme provided by the present application has the beneficial effects that:

[0021] In the above technical scheme, through the data access request, the electronic device can determine the data amount of the target data in the target device requested to be accessed, and receive a plurality of batches of sub-data in the target data sent by the target device in batches, so as to determine the transmission result of each batch of sub-data in the target data based on the data amount of the target data. Thus, even when large amount of device data is transmitted, on the one hand, the target device sends the large amount of device data in batches, and on the other hand, the electronic device determines the transmission result of each batch of sub-data in the target data based on the data amount of the target device, so as to stop receiving only after determining that all device data transmission is completed, thereby solving the problem that device data is easily lost in the transmission process in the related art, and further ensuring the stability of data transmission between the electronic device and the target device.

[0022] In addition, different models of target devices perform batch transmission of device data based on the transmission limit existing in the target devices, and the electronic device does not perceive the model of the target device, so as to effectively unify the data transmission scheme of the electronic device facing different models of target devices, and further facilitate reduction of maintenance cost. BRIEF DESCRIPTION OF DRAWINGS

[0023] In order to more clearly illustrate the technical schemes in the embodiments of the present application, the drawings needed to be used in the description of the embodiments of the present application will be briefly introduced.

[0024] Figure 1 is a schematic diagram according to the implementation environment involved in the present application;

[0025] Figure 2 is a flowchart of a device data transmission method according to an exemplary embodiment;

[0026] Figure 3 is a schematic diagram of a data viewing page according to an exemplary embodiment;

[0027] Figure 4This is a flowchart illustrating another device data transmission method according to an exemplary embodiment;

[0028] Figure 5 This is a schematic diagram illustrating a task queue following the first-in, first-out (FIFO) principle according to an exemplary embodiment;

[0029] Figure 6 It is a timing diagram of a device data transmission method in an application scenario;

[0030] Figure 7 This is a structural block diagram of a device data transmission apparatus according to an exemplary embodiment;

[0031] Figure 8 This is a hardware structure diagram of an electronic device according to an exemplary embodiment;

[0032] Figure 9 This is a structural block diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0033] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0034] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0035] As mentioned earlier, due to limitations in the storage capacity of smart devices, these devices themselves have transmission limitations, resulting in the problem that device data is easily lost during transmission.

[0036] It should be understood that smart devices can be targeted at different users, and as the number of users increases and the usage time of smart devices increases, the amount of device data stored in smart devices will also increase.

[0037] For smart devices with large storage capacity, whether it is a large amount of device data or a small amount of device data, it can achieve one-time throughput, that is, the target data requested by the electronic device is sent to the electronic device all at once. Then, for the electronic device, after receiving the device data, it is considered that the device data transmission is complete. At this time, there will be no situation where the device data is lost and cannot be received by the electronic device.

[0038] However, for smart devices with limited storage capacity, when transmitting large amounts of data between electronic devices and smart devices, the smart devices themselves have transmission limitations and can only return a small portion of the data at a time. In other words, large amounts of data need to be transmitted multiple times. At this point, the electronic device may assume that the data transmission is complete after receiving the first small portion of data returned by the smart device and begin other processing. As a result, subsequent data transmitted by the smart device may not be received by the electronic device, thus affecting the stability of data transmission between the electronic device and the smart device.

[0039] As can be seen from the above, the relevant technologies still have the drawback that device data is easily lost during transmission.

[0040] Therefore, the device data transmission method provided in this application can effectively improve the stability of data transmission between electronic devices and smart devices. Accordingly, the device data transmission method is applicable to device data transmission devices, which can be deployed on electronic devices, such as smartphones, tablets, laptops, desktop computers, etc.

[0041] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0042] Figure 1 This is a schematic diagram of an implementation environment involved in a device data transmission method. The implementation environment includes a user terminal 110, a smart device 130, a gateway 150, a server 170, and a router 190.

[0043] Specifically, user terminal 110, which can also be considered as user terminal or terminal, can deploy clients associated with smart device 130. This user terminal 110 can be an electronic device such as a smartphone, tablet, laptop, or desktop computer, and is not limited here.

[0044] The client, associated with the smart device 130, enables the user terminal 110 to run functions such as data configuration, access, display, and control of the smart device 130. This client can be in the form of an application or a webpage. Correspondingly, the user interface displayed on the client can be a program window or a webpage; no limitation is made here. It should be noted that "association" refers to adding the device identifier of the smart device 130 to the client, making the smart device 130 uniquely represented in the client through this identifier. This allows it to be displayed as a device identifier on relevant pages within the client and selected by the user, thereby providing the user with relevant functions related to the smart device 130.

[0045] Smart device 130 is deployed in gateway 150 and communicates with gateway 150 through its own configured communication module, thereby being controlled by gateway 150. In one application scenario, smart device 130 is deployed in gateway 150 by accessing it through a local area network (LAN). The process of smart device 130 accessing gateway 150 through the LAN includes: gateway 150 first establishing a LAN, and smart device 130 joining the LAN established by gateway 150 by connecting to it. This LAN includes, but is not limited to, ZIGBEE or Bluetooth. Smart device 130 can be a smart printer, smart fax machine, smart camera, smart air conditioner, smart door lock, smart light, or a human body sensor, door / window sensor, temperature and humidity sensor, water immersion sensor, natural gas alarm, smoke alarm, wall switch, wall socket, wireless switch, wireless wall sticker switch, cube controller, curtain motor, etc., equipped with a communication module.

[0046] The interaction between user terminal 110 and smart device 130 can be achieved through a local area network (LAN) or a wide area network (WAN). In one application scenario, user terminal 110 establishes a wired or wireless communication connection with gateway 150 via router 190, such as Wi-Fi, allowing user terminal 110 and gateway 150 to be deployed on the same LAN, thus enabling user terminal 110 to interact with smart device 130 via the LAN path. In another application scenario, user terminal 110 establishes a wired or wireless communication connection with gateway 150 via server 170, such as 2G, 3G, 4G, 5G, or Wi-Fi, allowing user terminal 110 and gateway 150 to be deployed on the same WAN, thus enabling user terminal 110 to interact with smart device 130 via the WAN path.

[0047] Among them, server 170 can also be considered as cloud, cloud platform, platform, server, etc. This server 170 can be a single server, a server cluster consisting of multiple servers, or a cloud computing center consisting of multiple servers, so as to better provide backend services to user terminal 110, smart device 130 and other electronic devices.

[0048] In the above-described implementation environment, the smart device 130 can transmit large amounts of data with electronic devices such as the user terminal 110, gateway 150, and server 170.

[0049] Please see Figure 2 This application provides a device data transmission method, which is applicable to electronic devices, specifically electronic devices that can be... Figure 1 The diagram shows user terminal 110, gateway 150, server 170, etc. in the implementation environment.

[0050] In the following method embodiments, for ease of description, the execution subject of each step of the method is an electronic device, but this does not constitute a specific limitation.

[0051] like Figure 2 As shown, the method may include the following steps:

[0052] Step 310: Send a data access request to the target device.

[0053] The data access request is used to indicate the target data in the target device that is requested for access. The target device refers to the smart device that is requesting access, and correspondingly, the target data refers to the device data in the smart device that is requested for access. For example, if the target device is a smart door lock, then the target data could be the door lock data stored in the smart door lock.

[0054] First, it should be noted that the target data is stored in the target device and includes, but is not limited to, user data and log data. In one embodiment, user data can be used to describe user identification and / or user type, such as a resident, neighbor, stranger, etc., and can also be used to describe the user creation time, etc. In one embodiment, log data is used to describe user operation behavior on the target device and its associated components. Taking a smart door lock as an example, the associated components of the smart door lock include, but are not limited to, the door, doorbell, etc. Then, door log data can be used to describe the resident's entry and exit behaviors at different times, door lock log data can be used to describe the resident's unlocking and unlocking behaviors at different times, and doorbell log data can be used to describe the doorbell ringing behaviors of neighbors, etc., at different times.

[0055] Secondly, the initiation of a data access request depends on the target data in the target device that is requested to be accessed. In one embodiment, the process of initiating a data access request may include the following steps: determining the target data in the target device that is requested to be accessed; encapsulating the target data to be accessed to generate a data access request; and sending the data access request to the target device.

[0056] Regarding the determination of target data, in one embodiment, device data is displayed in the form of data entries on the data viewing page of the user terminal. Each data entry is associated with the device data that can be accessed in the target device. It can also be understood that the data entry uniquely represents the device data that can be accessed in the target device, so that the user can select the target data in the target device to be accessed through the data entries displayed on the data viewing page. Figure 3 The diagram illustrates how data entries are displayed on the data viewing page, such as... Figure 3 As shown, when a user enters the data viewing page 301, they can see multiple data entries. Each data entry is associated with user data, door log data, door lock log data, and doorbell log data in the target device (specifically, the smart door lock). When the user clicks on data entry 302, it can be determined that the triggered data entry is data entry 302, and thus the target data requested by the user is the door lock log data associated with data entry 302.

[0057] Step 330: Receive the first data packet sent by the target device in response to the data access request.

[0058] The first data packet is used to indicate the amount of data in the target data.

[0059] As mentioned earlier, due to the transmission limitations of the target device itself, it can only return a small portion of the device data at a time. However, large amounts of device data need to be transmitted multiple times between the electronic device and the target device. This may cause the electronic device to assume that the device data has been transmitted completely after receiving the first small portion of device data returned by the target device, ultimately resulting in the electronic device being unable to receive the subsequent device data transmitted by the target device.

[0060] Therefore, before sending the target data, the target device first notifies the electronic device of the data size of the target data, thereby preventing the electronic device from starting other processing before receiving all the target data. Specifically, the target device encapsulates the target data size into a first data packet and sends the first data packet carrying the target data size to the electronic device. In one embodiment, the target data size is expressed in information units of measurement. For example, the target data size is 500KB (kilobytes).

[0061] Correspondingly, electronic devices can receive the first data packet and use it to determine the amount of data in the target data.

[0062] Furthermore, after determining the data volume of the target data, in one embodiment, a storage area matching the data volume is allocated to the target data to store all batches of sub-data within the target data. This allows the electronic device to pre-allocate the required storage area for the target data at once, avoiding the need for repeated storage area allocation operations based on the data volume of each batch of sub-data during subsequent transmissions. This not only saves the electronic device's operating memory but also improves its operating efficiency.

[0063] Step 350: Receive at least one second data packet sent by the target device in batches, each second data packet corresponding to a sub-data packet in a batch of target data.

[0064] The batch size of sub-data within the target data is related to the transmission limitations of the target device itself, that is, to the storage capacity of the target device. Taking a smart door lock as an example, if the smart door lock has 512KB of flash memory, then the transmission limitation of the smart door lock is that it can transmit 512KB of door lock data at a time. In other words, the transmission limitation of the target device is used to indicate the maximum transmission capacity of data transmitted between the target device and the electronic device at a time. In one embodiment, the transmission limitation of the target device can be expressed by information measurement units; in another embodiment, the transmission limitation of the target device can also be expressed by the number of data entries.

[0065] Assuming each piece of device data is 5KB, then the transmission limit of the target device is 512KB of device data that can be transmitted at a time. This can also be understood as the transmission limit of the target device being 100 pieces of device data that can be transmitted at a time. If the target data in the requested target device is 500 pieces of device data, then the target data can be divided into 5 batches of sub-data.

[0066] Correspondingly, the electronic device can receive 5 second data packets, each second data packet corresponding to a sub-data packet of a batch in the target data. For example, the third second data packet corresponds to the sub-data packet of the third batch in the target data.

[0067] Step 370: Based on the amount of data in the target data, determine the transmission results of sub-data in each batch of the target data.

[0068] The transmission result is used to indicate whether the sub-data of each batch in the target data has been transmitted completely, and / or to indicate whether the target data transmission has failed.

[0069] In one embodiment, step 370 may include the following steps: determining the batch and data volume of a currently received batch of sub-data based on the received second data packet; determining the data volume of each batch of sub-data based on the batch and data volume of the currently received batch of sub-data; and determining whether the transmission result indicates that the sub-data of each batch in the target data has been transmitted completely based on the data volume of the target data, the batch to which the currently received batch of sub-data belongs, and the data volume of each batch of sub-data.

[0070] The batch to which the sub-data belongs can be represented by the batch number. For example, if the sub-data belongs to the second batch, it can be represented by the batch number 2.

[0071] For example, suppose the batch number of the currently received batch of sub-data is 3 and the data size is 500KB. Then, the currently received batch also includes the first batch of sub-data and the second batch of sub-data. Therefore, the data size of the currently received batch of sub-data is 500KB + 500KB + 500KB = 1500KB.

[0072] In one embodiment, if the amount of data in the target data is equal to the amount of data in each batch of sub-data currently received, then the transmission result indicates that the transmission of each batch of sub-data in the target data has been completed.

[0073] In one embodiment, if the batch of sub-data currently received belongs to the last batch, then the transmission result indicates that the sub-data of each batch in the target data has been transmitted.

[0074] In one embodiment, if the amount of target data is equal to the amount of data in each batch of currently received sub-data, and the batch to which the currently received sub-data belongs is the last batch, then the transmission result indicates that the transmission of each batch of sub-data in the target data has been completed. Figure 4 As shown. This achieves the setting of a dual authentication standard, thereby verifying the complete reception of the target data.

[0075] Once the transmission of each batch of sub-data in the target data is complete, the electronic device stops receiving data and begins other processing. This prevents the electronic device from being unable to receive subsequent batches of sub-data transmitted by the target device, thereby improving the stability of data transmission between the electronic device and the target device.

[0076] In another embodiment, once it is determined that the transmission of each batch of sub-data within the target data has been completed, the target device is notified to release the storage resources for the target data, such as... Figure 4As shown. This storage resource refers to the storage area in the target device used to store the target data. Specifically, this storage area refers to the buffer, which is the temporary storage space reserved in memory by the target device for storing the target data. This approach not only helps reduce the number of actual physical read / write operations but also effectively reduces the number of times memory is dynamically allocated and reclaimed, thereby improving the data transfer performance of the target device.

[0077] Furthermore, the inventors realized that in the actual process of data transmission between the target device and the electronic device, there is still a small probability of some failures. For example, if a batch of sub-data is lost and data corruption occurs, the electronic device may remain in a data receiving state because the pre-allocated storage area is not full, which may eventually lead to memory overflow. Therefore, when data corruption occurs, when the electronic device determines that the target data transmission has failed, it can re-initiate a data access request to the target device based on the requested target data.

[0078] In one embodiment, such as Figure 4 As shown, data corruption scenarios include any of the following: First, the currently received batch of sub-data belongs to the last batch, but the target data size is not equal to the data size of all currently received batches of sub-data; Second, the currently received batch of sub-data does not belong to the last batch, but the target data size is equal to the data size of all currently received batches of sub-data. In either of these two scenarios, the transmission result indicates that the target data transmission has failed. Therefore, data corruption can be eliminated, thereby improving the stability of data transmission between the electronic device and the target device.

[0079] Through the above process, even when transmitting large amounts of device data, on the one hand, the target device sends large amounts of device data in batches, and on the other hand, the electronic device determines the transmission results of each batch of sub-data in the target data based on the data volume of the target device, so that it stops receiving only after confirming that all device data transmission is completed. This solves the problem of easy loss of device data during transmission in related technologies, and thus ensures the stability of data transmission between the electronic device and the target device.

[0080] Furthermore, different target devices transmit device data in batches based on their own transmission limitations. The electronic devices are unaware of the target device model, which can effectively unify the data transmission scheme of electronic devices for different target devices, thereby helping to reduce maintenance costs.

[0081] As mentioned earlier, we will still use a smart door lock as an example to illustrate the concept. Please refer back to [link to previous document]. Figure 3When a user enters the data viewing page 301, they will see multiple data entries. By clicking on data entry 302, it can be determined that the target data requested by the user is the door lock log data. Here, the inventors realized that if the door lock log data consists of a large amount of device data, the transmission of the door lock log data between the smart door lock and the electronic device would take some time. During this time, the user might click on a data entry again on the data viewing page; for example, the user might simultaneously request access to user data. Since the access to the door lock log data has not yet ended, and a new access to user data occurs at this time, conflicts will arise in the device data access within the electronic device due to resource contention, easily leading to delays and data loss in device data transmission.

[0082] Therefore, this application provides a possible implementation method, which may further include the following steps: creating a task set to store data access tasks, and obtaining data access tasks from the task set as data access requests to be sent to the target device.

[0083] Specifically, for the device data that can be accessed in the target device, a data access task is created; the data access task is added to the task set; and the data access task with the task status of pending execution is obtained from the task set as a data access request to be sent to the target device.

[0084] In one embodiment, the creation of a data access task may include the following steps: displaying data entries on a data viewing page, the data entries being associated with accessible device data on the target device; determining the triggered data entry in response to a triggering operation on the data entry on the data viewing page; and generating a data access task corresponding to the triggered data entry. It is worth noting that the creation of this data access task can occur either when no target data is being transmitted between the electronic device and the target device, or when various batches of sub-data from the target data are being transmitted between the electronic device and the target device; this is not limited here.

[0085] Among them, a data access task is used to indicate the target data in the target device that is requested for access. As can be seen from the above, in the case of multiple concurrent data access tasks, these multiple data access tasks can be converted into data access requests respectively. Specifically, if the task status includes at least two states: pending execution and execution, then the data access task with the pending execution status is sent to the target device as a data access request.

[0086] In one embodiment, the task set is a task queue that follows the first-in, first-out (FIFO) principle.

[0087] like Figure 5As shown in (a), on one hand, at the head of the task queue 500 510: in the task queue 500, the task status of the data access task 501 located at the head of the queue 510 is determined; when the determined task status is pending execution, the data access task 501 located at the head of the queue 510 is sent as a data access request to the target device, and the task status of the data access task 501 located at the head of the queue 501 is changed from pending execution to execution, that is, at this time the data access task 502 located at the head of the queue 510 is in the execution state; after the data access task 502 in the execution state is completed, this data access task 502 is removed from the task queue 500, and at the same time, the data access task 503 located after this data access task 502 in the task queue 500 is moved to the head of the queue 510.

[0088] like Figure 5 As shown in (b), on the other hand, at the tail 530 of the task queue 500: a data access task 504 is created for the device data that can be accessed in the target device; on the one hand, when the sub-data of each batch in the target data has not been completely transmitted, the task status of the created data access task 504 is configured to be in the pending execution state, that is, the data access task 505 with the task status in the pending execution state, and the data access task 505 is added to the tail 530 of the task queue 500; on the other hand, if no target data is transmitted between the electronic device and the target device, and there are no other data access tasks in the task queue 500, the task status of the created data access task 504 is configured to be in the execution state, that is, the data access task 506 with the task status in the execution state, and the data access task 506 is added to the tail 530 of the task queue 500, that is, added to the head 510 of the task queue 500.

[0089] Thus, a task queue consisting of serial data access tasks is implemented. Using a first-in-first-out request strategy, in the case of multiple concurrent data access tasks, data access tasks in the pending state are added to the tail of the queue in sequence. Only the data access task in the pending state at the head of the queue is processed each time, and it is removed from the task queue when the data access task is completed, thereby avoiding multiple concurrent data access tasks from competing for resources.

[0090] Under the above embodiments, by setting task sets, conflicts in device data access due to resource contention in electronic devices are avoided, thereby preventing device data transmission delays and losses, and ultimately improving the stability of data transmission between electronic devices and target devices.

[0091] Please see Figure 6 , Figure 6This diagram illustrates a timing sequence for data transmission between an electronic device and a target device in an application scenario. In this scenario, the electronic device is a user terminal, and the target device is a smart door lock.

[0092] like Figure 6 As shown, the process of transmitting door lock data between the user terminal and the smart door lock may include the following steps:

[0093] Step 1: The user terminal requests to obtain the target data from the smart lock.

[0094] Step 2: The smart lock notifies the user terminal of the target data volume, assuming the target data volume is 500 lock data entries.

[0095] Step 3: The user terminal records the amount of target data and waits for the smart lock to send the target data. Here, the user terminal can further pre-allocate a storage area matching the amount of target data based on the data volume.

[0096] Step 4: The smart lock sends the target data in batches based on its inherent transmission limitations. Specifically, assuming the smart lock's transmission limit is 100 lock data entries per transmission, the target data of 500 lock data entries will be divided into 5 batches of sub-data, with batch numbers 1, 2, 3, 4, and ff. The batch number ff is pre-configured to identify the last batch of sub-data; however, characters, letters, or other formats can also be used to identify the last batch, which is not a specific limitation.

[0097] Step 5: After the data transmission of the five batches of sub-data is completed, on the one hand, the user terminal can process the received target data or start other processing; on the other hand, the user terminal will notify the smart door lock to release the buffer for the target data.

[0098] In the above process, on the one hand, the smart lock sends large amounts of device data in batches, and on the other hand, the user terminal stops receiving data only after confirming that the large amount of device data has been received. This solves the problem of easy loss of device data during transmission in related technologies, thereby ensuring the stability of data transmission between the user terminal and the smart lock.

[0099] Furthermore, regardless of the model of the smart lock, and without considering the different transmission limitations of different smart lock models, the batch number of the last batch of sub-data can be pre-configured as ff. Therefore, for the user terminal, if the batch number of the currently received batch of sub-data is ff, it can be determined that the sub-data of each batch in the target data has been transmitted.

[0100] This shows that although different models of smart locks transmit device data in batches based on their own transmission limitations, the user terminal is unaware of the smart lock model. This effectively unifies the data transmission scheme for different models of smart locks on the user terminal, thereby helping to reduce maintenance costs.

[0101] The following are embodiments of the apparatus described in this application, which can be used to execute the device data transmission method involved in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments of the device data transmission method involved in this application.

[0102] Please see Figure 7 This application provides a data transmission device 900, including but not limited to: a request sending module 910, a first data packet receiving module 930, a second data packet receiving module 950, and a result determination module 970.

[0103] The request sending module 910 is used to send a data access request to the target device. The data access request is used to indicate the target data in the target device that is requested to be accessed.

[0104] The first data packet receiving module 930 is used to receive a first data packet sent by the target device in response to a data access request. The first data packet is used to indicate the amount of data in the target data.

[0105] The second data packet receiving module 950 is used to receive at least one second data packet sent by the target device in batches, each second data packet corresponding to a sub-data packet in a batch of target data;

[0106] The result determination module 970 is used to determine the transmission results of each batch of sub-data in the target data based on the amount of data in the target data.

[0107] In one exemplary embodiment, the device data transmission apparatus further includes: a task creation module for creating a data access task for accessible device data in the target device; and a task addition module for adding the data access task to a task set to obtain the data access task from the task set as a data access request to be sent to the target device.

[0108] In one exemplary embodiment, the task creation module includes: an item display unit for displaying data items on a data viewing page, the data items being associated with accessible device data in a target device; an item triggering unit for determining a triggered data item in response to a triggering operation on a data item in the data viewing page; and a task generation unit for generating a data access task corresponding to the triggered data item.

[0109] In an exemplary embodiment, the task set is a task queue; the task adding module includes: a tail adding unit, used to configure the task status of the data access task to a pending execution state and add it to the tail of the task queue when the sub-data of each batch in the target data has not been completely transmitted.

[0110] In one exemplary embodiment, the task set is a task queue; the above-mentioned device data transmission apparatus further includes a request acquisition module, which includes: a status determination unit, configured to determine the task status of the data access task located at the head of the queue in the task queue; a status modification unit, configured to, when the determined task status is a pending execution status, take the data access task located at the head of the queue as a data access request to be sent to the target device, and modify the task status of the data access task located at the head of the queue from the pending execution status to the execution status; and a head-of-queue removal unit, configured to wait for the data access task in the execution status to finish execution, and remove the data access task in the execution status from the task queue.

[0111] In an exemplary embodiment, the result determination module includes: a first determination unit, configured to determine the batch and data size of a currently received batch of sub-data based on the received second data packet; a second determination unit, configured to determine the data size of each batch of sub-data currently received based on the batch and data size of the currently received batch of sub-data; and a transmission determination unit, configured to determine whether the transmission result indicates that the transmission of each batch of sub-data in the target data has been completed based on the data size of the target data, the batch to which the currently received batch of sub-data belongs, and the data size of each batch of sub-data currently received.

[0112] In one exemplary embodiment, the transmission determination unit includes: a first transmission completion determination subunit, configured to determine that the transmission result indicates that the transmission of each batch of sub-data in the target data has been completed if the data volume of the target data is equal to the data volume of each batch of sub-data currently received; and / or a second transmission completion determination subunit, configured to determine that the transmission result indicates that the transmission of each batch of sub-data in the target data has been completed if the batch to which the currently received batch of sub-data belongs is the last batch.

[0113] In one exemplary embodiment, the transmission determination unit includes: a first transmission failure determination subunit, configured to determine that the transmission result indicates target data transmission failure if the batch to which the currently received batch of sub-data belongs is the last batch, but the data volume of the target data is not equal to the data volume of each batch of sub-data currently received; or a second transmission failure determination subunit, configured to determine that the transmission result indicates target data transmission failure if the batch to which the currently received batch of sub-data belongs is not the last batch, but the data volume of the target data is equal to the data volume of each batch of sub-data currently received.

[0114] In one exemplary embodiment, the above-mentioned device data transmission apparatus further includes: a resource allocation module, configured to allocate a storage area matching the data volume of the target data based on the data volume of the target data; and a resource release module, configured to notify the target device to release the storage resources for the target data when all the sub-data of each batch in the target data are stored in the storage area.

[0115] It should be noted that the device data transmission device provided in the above embodiments is only illustrated by the division of the above functional modules when performing device data transmission. In actual applications, the above functions can be assigned to different functional modules as needed. That is, the internal structure of the device data transmission device will be divided into different functional modules to complete all or part of the functions described above.

[0116] Furthermore, the embodiments of the device data transmission apparatus and the device data transmission method provided in the above embodiments belong to the same concept, and the specific way in which each module performs operations has been described in detail in the method embodiments, and will not be repeated here.

[0117] Figure 8 A schematic diagram of the structure of an electronic device is shown according to an exemplary embodiment. This electronic device is suitable for... Figure 1 The user terminal 110, gateway 150, and server 170 are shown in the implementation environment.

[0118] It should be noted that this electronic device is merely an example adapted to this application and should not be construed as providing any limitation on the scope of use of this application. Furthermore, this electronic device should not be interpreted as requiring or depending on any specific feature. Figure 8 One or more components of the exemplary electronic device 2000 shown.

[0119] The hardware structure of electronic devices 2000 can vary significantly due to differences in configuration or performance, such as... Figure 8 As shown, the electronic device 2000 includes: a power supply 210, an interface 230, at least one memory 250, and at least one central processing unit (CPU) 270.

[0120] Specifically, power supply 210 is used to provide operating voltage for various hardware devices on electronic device 2000.

[0121] Interface 230 includes at least one wired or wireless network interface for interacting with external devices. For example, to perform... Figure 1 The diagram illustrates the interaction between the user terminal and the smart device 130 in the implementation environment.

[0122] Of course, in other examples adapted in this application, interface 230 may further include at least one serial-to-parallel conversion interface 233, at least one input / output interface 235, and at least one USB interface 237, etc. Figure 8 As shown, this does not constitute a specific limitation.

[0123] The memory 250 serves as a carrier for resource storage and can be a read-only memory, random access memory, disk, or optical disk, etc. The resources stored on it include the operating system 251, application programs 253, and data 255, etc., and the storage method can be temporary storage or permanent storage.

[0124] The operating system 251 is used to manage and control the various hardware devices and application programs 253 on the electronic device 2000, so as to enable the central processing unit 270 to perform calculations and processing on the massive data 255 in the memory 250. It can be Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.

[0125] Application 253 is a computer program that performs at least one specific task based on operating system 251, and may include at least one module ( Figure 8 (Not shown), each module may contain a computer program for the electronic device 2000. For example, the device data transmission device may be considered as an application program 253 deployed on the electronic device 2000.

[0126] Data 255 can be photos, pictures, etc. stored on a disk, or data access requests, device data, etc., stored in memory 250.

[0127] The central processing unit 270 may include one or more processors and is configured to communicate with the memory 250 via at least one communication bus to read computer programs stored in the memory 250, thereby performing operations and processing on massive amounts of data 255 stored in the memory 250. For example, the device data transfer method may be completed by the central processing unit 270 reading a series of computer programs stored in the memory 250.

[0128] Furthermore, this application can also be implemented through hardware circuits or a combination of hardware circuits and software. Therefore, the implementation of this application is not limited to any specific hardware circuit, software, or combination thereof.

[0129] Please see Figure 9 This application provides an electronic device 4000, which may include: smartphones, tablets, laptops, desktop computers, etc.

[0130] exist Figure 9The electronic device 4000 includes at least one processor 4001, at least one communication bus 4002, and at least one memory 4003.

[0131] The processor 4001 and memory 4003 are connected, for example, via a communication bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0132] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.

[0133] The communication bus 4002 may include a path for transmitting information between the aforementioned components. The communication bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 4002 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0134] The memory 4003 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.

[0135] The memory 4003 stores a computer program, and the processor 4001 reads the computer program stored in the memory 4003 through the communication bus 4002.

[0136] When the computer program is executed by the processor 4001, it implements the device data transmission methods in the above embodiments.

[0137] Furthermore, this application provides a storage medium storing a computer program, which, when executed by a processor, implements the device data transmission methods described in the above embodiments.

[0138] This application provides a computer program product comprising a computer program stored in a storage medium. A processor of a computer device reads the computer program from the storage medium and executes the computer program, causing the computer device to perform the device data transmission methods described in the above embodiments.

[0139] Compared with related technologies, even when transmitting large amounts of device data, the electronic device solves the problem of data loss during transmission in related technologies by having the target device send large amounts of device data in batches, and the electronic device determines the transmission results of each batch of sub-data in the target data based on the amount of data in the target device. This ensures that reception stops only after all device data has been received.

[0140] Furthermore, different target devices transmit device data in batches based on their own transmission limitations. The electronic devices are unaware of the target device model, which can effectively unify the data transmission scheme of electronic devices for different target devices, thereby helping to reduce maintenance costs.

[0141] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0142] The above description is only a partial embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A device data transmission method, characterized by, The method comprises: sending a data access request to a target device, the data access request being used to indicate target data in the target device requested to be accessed; receiving a first data packet sent by the target device in response to the data access request, the first data packet being used to indicate a data amount of the target data; receiving at least one second data packet sent by the target device in batches, each second data packet corresponding to sub data of a batch in the target data; determining a transmission result of the sub data of each batch in the target data based on the data amount of the target data, a batch to which the currently received sub data of a batch belongs, and data amounts of the currently received sub data of each batch; wherein: if the batch to which the currently received sub data of a batch belongs is the last batch, but the data amount of the target data is not equal to the data amounts of the currently received sub data of each batch, it is determined that the transmission result indicates that the target data transmission fails; if the batch to which the currently received sub data of a batch belongs is not the last batch, but the data amount of the target data is equal to the data amounts of the currently received sub data of each batch, it is determined that the transmission result indicates that the target data transmission fails; in a case where it is determined that the transmission result indicates that the target data transmission fails, the electronic device continues the reception of the target data and suspends other processing until the transmission result indicates that the sub data of each batch in the target data is completely transmitted, and the electronic device stops the reception of the target data and starts other processing.

2. The method of claim 1, wherein, Before the sending of the data access request to the target device, the method further comprises: creating a data access task for device data available for access in the target device; adding the data access task to a task set, so as to obtain the data access task from the task set as the data access request sent to the target device.

3. The method of claim 2, wherein, The creating of the data access task for the device data available for access in the target device comprises: displaying a data entry in a data viewing page, the data entry being associated with the device data available for access in the target device; determining a triggered data entry in response to a triggering operation on the data entry in the data viewing page; generating a data access task corresponding to the triggered data entry.

4. The method of claim 2, wherein, The task set is a task queue; The adding of the data access task to the task set comprises: when the sub data of each batch in the target data is not completely transmitted, configuring a task state of the data access task as a to-be-executed state and adding the data access task to a tail of the task queue.

5. The method of claim 2, wherein, The task set is a task queue; After the adding of the data access task to the task set, the method further comprises: determining a task state of a data access task located at a head of the task queue; when the determined task state is the to-be-executed state, taking the data access task located at the head as the data access request sent to the target device, and modifying the task state of the data access task located at the head from the to-be-executed state to an executed state. Waiting for the data access task in the execution state to be executed, the data access task in the execution state is removed from the task queue.

6. The method of claim 1, wherein, The transmission result of the sub-data of each batch in the target data is determined based on the data amount of the target data, the batch to which the currently received one batch of sub-data belongs, and the data amount of each batch of sub-data currently received. The batch to which the currently received one batch of sub-data belongs and the data amount are determined based on the received second data packet. The data amount of each batch of sub-data currently received is determined according to the batch to which the currently received one batch of sub-data belongs and the data amount. Whether the transmission result indicates that the sub-data of each batch in the target data is transmitted completely is determined according to the data amount of the target data, the batch to which the currently received one batch of sub-data belongs, and the data amount of each batch of sub-data currently received.

7. The method of claim 6, wherein, The transmission result indicates that the sub-data of each batch in the target data is transmitted completely if the data amount of the target data is equal to the data amount of each batch of sub-data currently received; and / or The transmission result indicates that the sub-data of each batch in the target data is transmitted completely if the batch to which the currently received one batch of sub-data belongs is the last batch. The method further comprises the following steps after the first data packet is received:

8. The method according to any one of claims 1 to 7, characterized in that, A storage area matching the data amount of the target data is allocated for the target data based on the data amount of the target data. When all the sub-data of each batch in the target data is stored in the storage area, the target device is informed to release the storage resource for the target data. The device comprises:

9. An apparatus data transfer device, characterized by The request sending module is configured to send a data access request to a target device, the data access request being used to indicate target data in the target device requested to be accessed; The first data packet receiving module is configured to receive a first data packet sent by the target device in response to the data access request, the first data packet being used to indicate a data amount of the target data; The second data packet receiving module is configured to receive at least one second data packet sent by the target device in batches, each second data packet corresponding to sub-data of one batch in the target data; ​ A result determining module is configured to determine a transmission result of each batch of sub data in the target data based on a data amount of the target data, a batch to which a currently received batch of sub data belongs, and data amounts of each batch of sub data currently received; wherein: if the batch to which the currently received batch of sub data belongs is the last batch, but the data amount of the target data is not equal to the data amounts of each batch of sub data currently received, it is determined that the transmission result indicates that the target data transmission fails; if the batch to which the currently received batch of sub data belongs is not the last batch, but the data amount of the target data is equal to the data amounts of each batch of sub data currently received, it is determined that the transmission result indicates that the target data transmission fails; in a case where it is determined that the transmission result indicates that the target data transmission fails, the electronic device continues to receive the target data and suspends other processing until it is determined that the transmission result indicates that each batch of sub data in the target data is completely transmitted, and the electronic device stops receiving the target data and starts other processing.

10. An electronic device, comprising: Comprise: at least one processor, at least one memory, and at least one communication bus, wherein, the memory has stored thereon a computer program, and the processor reads the computer program in the memory through the communication bus; the computer program is executed by the processor to implement the device data transmission method in any one of claims 1 to 8.

11. A storage medium having stored thereon a computer program, characterized in that the computer program is executed by the processor to implement the device data transmission method in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Internet of things data transmission method, device and system

    CN109936588A