A data transmission system, method, device, electronic device and storage medium
By implementing an incremental issuance mechanism on the cloud server side of IoT devices, data is distributed in batches to avoid buffer overflow, the buffer overflow problem caused by IoT devices receiving big data is solved, and efficient data processing and cost control are achieved.
Patent Information
- Application Number
- CN202211317508.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-10-26
AI Technical Summary
When IoT devices receive large amounts of data sent by cloud servers, they can easily cause data receiving buffer overflow, and increasing buffer capacity will increase equipment costs.
By implementing an incremental issuance mechanism on the server side, data is distributed to IoT devices in batches, and data to be distributed is managed using the device shadow to be distributed to ensure that the amount of data sent each time is not greater than the device's receiving buffer capacity.
Without increasing the cost of the equipment, the data receiving buffer overflow problem is avoided and the processing efficiency of the equipment for distributing data is improved.
Smart Images

Figure CN115695550B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and in particular, to a data transmission system, method, device, electronic device, and storage medium. Background Art
[0002] Currently, Internet of Things (IoT) devices are widely used. During the application of the IoT, IoT devices need to interact with the cloud. Before data interaction, it is necessary to create a device shadow of the IoT device in the cloud.
[0003] Among them, the so-called device shadow refers to a data file stored in the cloud, which is a virtual mapping of the IoT device in the cloud and can be used to record relevant data of the IoT device. Exemplarily, the device shadow can record the configuration of the attributes of the IoT device, that is, the desired attribute values. When it is necessary to modify the attribute values of the IoT device, the desired attribute values of the device shadow can be modified. Furthermore, the cloud server can send the desired attribute values to the IoT device to implement the control of the state of the IoT device by the cloud.
[0004] However, the capacity of the data reception buffer of the IoT device is limited. If the cloud server sends data larger than the capacity of the data reception buffer of the IoT device to the IoT device, it will cause the data reception buffer of the IoT device to overflow, thus unable to complete the data sending task.
[0005] To address the above problems, in the related art, the capacity of the data reception buffer of the IoT device is increased to reduce the problem of data reception buffer overflow. However, increasing the capacity of the data reception buffer will increase the cost of the IoT device, and after increasing the capacity of the data reception buffer, the data that the data reception buffer can receive is still limited, and it may be necessary to increase the capacity of the data reception buffer again. Summary of the Invention
[0006] The purpose of the embodiments of this application is to provide a data transmission system, method, device, electronic device, and storage medium to solve the problem of device data reception buffer overflow caused by the server sending data with a data volume larger than the capacity of the device's data reception buffer to the device without increasing the device cost. The specific technical solutions are as follows:
[0007] In a first aspect, the embodiments of this application provide a data transmission system, the system includes: a target device and a server; the server is provided with the device shadow of the target device;
[0008] The server is configured to determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending notification for prompting the target device to send an incremental sending request to the target device;
[0009] The target device is used to receive the data distribution notice and send the incremental distribution request to the server; wherein, the incremental distribution request includes the first capacity of the data receiving buffer of the target device.
[0010] The server is further configured to receive the incremental distribution request; according to the incremental distribution request, determine a specified array in the to-be-distributed data that has not been distributed, where the sum of the first data amounts of the specified array is not greater than the first capacity; if there is no to-be-distributed data that has not been determined as the specified array, send the specified array with a specified identifier to the target device; otherwise, send the specified array to the target device; wherein, the specified identifier is used to indicate that after the specified array is distributed, there is no to-be-distributed data that has not been distributed on the server.
[0011] The target device is further configured to receive the specified array and perform data processing on the specified array; if it is detected that the specified array carries the specified identifier, send a distribution termination signal to the server to indicate that all the to-be-distributed data has been received, otherwise, return to the step of sending the incremental distribution request to the server.
[0012] The server is further configured to receive the distribution termination signal.
[0013] Optionally, in a specific implementation,
[0014] The server is further configured to, before sending a data distribution notice to the target device to prompt the target device to send an incremental distribution request, extract the array identifier of each array in the to-be-distributed data, and construct an identifier list based on the extracted array identifiers.
[0015] The server determines a specified array in the to-be-distributed data that has not been distributed, where the sum of the first data amounts of the specified array is not greater than the first capacity, according to the incremental distribution request, including:
[0016] Traverse each array in the to-be-distributed data that has not been distributed in sequence, starting from the first array in the to-be-distributed data that has not been distributed, according to the array arrangement order represented by the identifier list.
[0017] When each array is traversed, calculate the sum of the first data amounts of the traversed array.
[0018] When the sum of the first data amounts is not greater than the first capacity, traverse the next array.
[0019] When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine all the arrays traversed, except the last array, as the specified array.
[0020] Optionally, in a specific implementation, the incremental download request further includes: the specified array identifier of the last received array;
[0021] Traversing each array in the to-be-downloaded data that has not been downloaded in sequence starting from the first array in the to-be-downloaded data according to the array arrangement order represented by the identifier list includes:
[0022] Traversing each array in the to-be-downloaded data in sequence starting from the array to which the next array identifier after the specified array identifier belongs according to the array arrangement order represented by the identifier list.
[0023] Optionally, in a specific implementation, the incremental download request further includes: a specified quantity;
[0024] Determining, according to the incremental download request, the specified arrays in the to-be-downloaded data that have not been downloaded and whose sum of the first data amounts is not greater than the first capacity includes:
[0025] Traversing each array in the to-be-downloaded data that has not been downloaded; when traversing each array, determining the sum of the first data amounts of the traversed array and the quantity of the traversed array;
[0026] If the sum of the first data amounts is not greater than the first capacity and the quantity is less than the specified quantity, then traverse the next array;
[0027] If the sum of the first data amounts is not greater than the first capacity and the quantity is equal to the specified quantity, then stop traversing and determine the traversed arrays as the specified arrays;
[0028] If the sum of the first data amounts is greater than the first capacity and the quantity is not greater than the specified quantity, then stop traversing and determine, among the traversed arrays, the arrays other than the last array as the specified arrays.
[0029] Optionally, in a specific implementation,
[0030] The server is further configured to delete the stored specified arrays.
[0031] Optionally, in a specific implementation, the incremental download request further includes: the target number of times for the target device to receive the specified arrays;
[0032] The server deleting the stored specified arrays includes:
[0033] Read the target number in the incremental distribution request, and calculate the difference between the target number and 1; if the specified number of times to delete the specified array currently recorded by the server is equal to the difference, then delete the most recently determined specified array before receiving this incremental distribution request, and update the specified number to the sum of the currently recorded specified number and 1; wherein, the initial value of the specified number is 0;
[0034] After receiving the distribution termination signal, delete the last determined specified array.
[0035] Optionally, in a specific implementation,
[0036] The server determines the data to be distributed stored in the device shadow in the form of a specified object array, including;
[0037] Receive the expected attribute value of the target device sent by the user through the user terminal, and store the expected attribute value in the device shadow in the form of a specified object array as the data to be distributed;
[0038] The target device processes the data of the specified array, including:
[0039] The target device sets attributes according to the specified array.
[0040] Optionally, in a specific implementation,
[0041] The target device is further configured to determine the data to be reported stored in the form of the specified object array, and send the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported to the server; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0042] The server is further configured to receive the device identifier, the specified information, and the target identifier array; if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or, the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, then send a data reporting notification for prompting the target device to report the data to be reported to the target device;
[0043] The target device is further configured to receive the data reporting notification; determine a target array in the data to be reported that has not been reported and the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and report the target array to the server;
[0044] The server is further configured to receive the target array, store the target array in the device shadow of the target device, and send a first response message to the server;
[0045] The target device is further configured to receive the first response message; if it is detected that there is pending data to be reported that has not been reported, return to the step of determining a target array in which the sum of the second data amounts of the unreported pending data is not greater than the second capacity of the data transmission buffer of the target device.
[0046] Optionally, in a specific implementation manner, the determining the pending data stored in the form of the specified object array includes:
[0047] Obtain local data to be reported with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the pending data.
[0048] Optionally, in a specific implementation manner,
[0049] The target device is further configured to, when reporting the target array for the first time, report a first signal to the server for indicating that data reporting is performed for the first time;
[0050] If after determining the target array, it is detected that there is pending data that has not been determined as the target array, then when reporting the target array to the server, report a second signal to the server for indicating data reporting;
[0051] If after determining the target array, it is detected that there is no pending data that has not been determined as the target array, then when reporting the target array to the server, report a third signal to the server for indicating that it is the last time to perform data reporting;
[0052] The server is further configured to receive the first signal, the second signal or the third signal.
[0053] Optionally, in a specific implementation manner,
[0054] The target device is further configured to, when detecting a change in the running state, determine specified data with data updates; and report the specified data and a fourth signal for indicating data update to the server; wherein the data amount of the specified data is not greater than the second capacity of the data transmission buffer of the target device;
[0055] The server is further configured to receive the specified data and the fourth signal; update the data stored in the device shadow of the target device by using the specified data, and send a second response message to the target device;
[0056] The target device is further configured to receive the second response message.
[0057] In a second aspect, an embodiment of the present application provides a data transmission method, which is applied to a server in a data transmission system. The data transmission system further includes a target device, and the server is provided with a device shadow of the target device. The method includes:
[0058] Determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending-down notice to the target device to prompt the target device to send an incremental sending-down request, so that after receiving the data sending-down notice, the target device sends the incremental sending-down request to the server; wherein, the incremental sending-down request includes a first capacity of a data reception buffer of the target device;
[0059] Receive the incremental sending-down request, and determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending-down request;
[0060] If there is no data to be sent down that has not been determined as the specified array, send the specified array carrying a specified identifier to the target device, so that the target device receives the specified array, processes the data of the specified array, and when detecting that the specified array carries the specified identifier, sends a sending-down termination signal to the server to indicate that all the data to be sent down has been received; wherein, the specified identifier is used to indicate that after sending down the specified array, there is no data to be sent down that has not been sent down by the server;
[0061] If there is data to be sent down that has not been determined as the specified array, send the specified array to the target device, so that the target device receives the specified array, processes the data of the specified array, and when detecting that the specified array does not carry the specified identifier, sends a new incremental sending-down request to the server;
[0062] Receive the sending-down termination signal;
[0063] Or,
[0064] Receive the new incremental sending-down request, and return to the step of determining a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending-down request.
[0065] Optionally, in a specific implementation manner, the method further includes:
[0066] Before sending the data distribution notification for prompting the target device to send an incremental download request to the target device, extract the array identifier of each array in the data to be downloaded, and construct an identifier list based on the extracted array identifiers;
[0067] The determining, according to the incremental download request, the specified arrays in the data to be downloaded whose sum of the first data amounts is not greater than the first capacity includes:
[0068] Traverse each array in the data to be downloaded that has not been downloaded in sequence starting from the first array in the data to be downloaded that has not been downloaded according to the array arrangement order represented by the identifier list;
[0069] When traversing each array, calculate the sum of the first data amounts of the traversed array;
[0070] When the sum of the first data amounts is not greater than the first capacity, traverse the next array;
[0071] When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine the arrays other than the last array among the traversed arrays as the specified arrays.
[0072] Optionally, in a specific implementation manner, the incremental download request further includes: the specified array identifier of the last received array;
[0073] The traversing each array in the data to be downloaded that has not been downloaded in sequence starting from the first array in the data to be downloaded that has not been downloaded according to the array arrangement order represented by the identifier list includes:
[0074] Traverse each array in the data to be downloaded in sequence starting from the array to which the next array identifier after the specified array identifier belongs according to the array arrangement order represented by the identifier list.
[0075] Optionally, in a specific implementation manner, the incremental download request further includes: a specified quantity;
[0076] The determining, according to the incremental download request, the specified arrays in the data to be downloaded whose sum of the first data amounts is not greater than the first capacity includes:
[0077] Traverse each array in the data to be downloaded that has not been downloaded; when traversing each array, determine the sum of the first data amounts of the traversed array and the quantity of the traversed array;
[0078] If the sum of the first data amounts is not greater than the first capacity and the quantity is less than the specified quantity, traverse the next array;
[0079] If the sum of the first data amounts is not greater than the first capacity and the quantity is equal to the specified quantity, stop traversing and determine each traversed array as the specified array;
[0080] If the sum of the first data amounts is greater than the first capacity and the quantity is not greater than the specified quantity, stop traversing and determine, among the traversed arrays, all arrays except the last one as the specified arrays.
[0081] Optionally, in a specific implementation manner, the method further includes:
[0082] Delete the stored specified arrays.
[0083] Optionally, in a specific implementation manner, the incremental distribution request further includes: the target number of times for the target device to receive the specified array;
[0084] The deleting the stored specified arrays includes:
[0085] Read the target number of times in the incremental distribution request and calculate the difference between the target number of times and 1; if the specified number of times currently recorded by the server for deleting the specified arrays is equal to the difference, delete the most recently determined specified arrays before receiving this incremental distribution request, and update the specified number of times to the sum of the currently recorded specified number of times and 1; where the initial value of the specified number of times is 0;
[0086] After receiving the distribution termination signal, delete the last determined specified arrays.
[0087] Optionally, in a specific implementation manner, the determining the data to be distributed stored in the device shadow in the form of a specified object array includes;
[0088] Receive the expected attribute value of the target device sent by the user through the user terminal, and store the expected attribute value in the device shadow in the form of a specified object array as the data to be distributed.
[0089] Optionally, in a specific implementation manner, the method further includes:
[0090] Receive, after the target device determines the data to be reported stored in the form of the specified object array, the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported; where the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0091] If the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, a data reporting notification for prompting the target device to report the data to be reported is sent to the target device, so that after receiving the data reporting notification, the target device determines a target array in the data to be reported that has not been reported and the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reports the target array to the server;
[0092] Receive the target array, store the target array in the device shadow of the target device, and send a first response message to the server, so that the target device receives the first response message;
[0093] Receive the target device to determine a target array in the data to be reported that has not been reported and the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device when detecting that there is data to be reported that has not been reported, and return to the step of receiving the target array.
[0094] Optionally, in a specific implementation manner, the determining the data to be reported stored in the form of the specified object array includes:
[0095] Obtain local data to be reported and with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0096] Optionally, in a specific implementation manner, the method further includes:
[0097] Receive a first signal, a second signal or a third signal sent by the target device;
[0098] Wherein, the first signal is: when the target device reports the target array for the first time, a signal for characterizing the first data reporting is reported to the server; the second signal is: when the target device determines the target array and detects that there is data to be reported that has not been determined as the target array, when reporting the target array to the server, a signal for characterizing the data reporting is reported to the server; the third signal is: when the target device determines the target array and detects that there is no data to be reported that has not been determined as the target array, when reporting the target array to the server, a signal for characterizing the last data reporting is reported to the server.
[0099] Optionally, in a specific implementation manner, the method further includes:
[0100] Receive the specified data sent by the target device and a fourth signal for characterizing data update; wherein, the specified data is the specified data with data update determined by the target device when detecting a change in the operating state, and the data volume of the specified data is not greater than the second capacity of the data sending buffer of the target device;
[0101] Use the specified data to update the data stored in the device shadow of the target device, and send a second response message to the target device so that the target device receives the second response message.
[0102] In a third aspect, an embodiment of the present application provides a data transmission method, which is applied to a target device in a data transmission system, and the data transmission system further includes a server, and the server is provided with a device shadow of the target device; the method includes:
[0103] Receive a data distribution notice; wherein, the data distribution notice is a notice sent by the server to the target device after determining the data to be distributed stored in the device shadow in the form of a specified object array, for prompting the target device to send an incremental distribution request;
[0104] Send the incremental distribution request to the server; wherein, the incremental distribution request includes the first capacity of the data receiving buffer of the target device, so that after receiving the incremental distribution request, the server determines, according to the incremental distribution request, a specified array whose sum of the first data volumes is not greater than the first capacity among the undistributed data to be distributed, and if there is no undistributed data to be distributed that is not determined as the specified array, then send the specified array with a specified identifier to the target device; otherwise, send the specified array to the target device; wherein, the specified identifier is used to characterize that after sending the specified array, the server has no undistributed data to be distributed;
[0105] Receive the specified array and perform data processing on the specified array;
[0106] If it is detected that the specified array carries the specified identifier, send a distribution termination signal for characterizing that all the data to be distributed has been received to the server so that the server receives the distribution termination signal;
[0107] Otherwise, return to the step of sending the incremental distribution request to the server.
[0108] Optionally, in a specific implementation manner, the data to be distributed includes: the expected attribute value of the target device sent by the user through the user terminal;
[0109] Performing data processing on the specified array includes:
[0110] Performing attribute setting according to the specified array.
[0111] Optionally, in a specific implementation manner, the method further includes:
[0112] Determining the data to be reported stored in the form of the specified object array, and sending the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported to the server, so that after receiving the device identifier, the specified information, and the target identifier array, if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, the server sends a data reporting notification for prompting the target device to report the data to be reported to the target device; wherein, the specified information includes: the type of the data to be reported, and / or the version number of the data to be reported;
[0113] Receiving the data reporting notification; determining a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reporting the target array to the server, so that after receiving the target array, the server stores the target array in the device shadow of the target device and sends a first response message to the server;
[0114] Receiving the first response message; if it is detected that there is unreported data to be reported, returning to the step of determining a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device.
[0115] Optionally, in a specific implementation manner, determining the data to be reported stored in the form of the specified object array includes:
[0116] Obtaining local data to be reported and having a data amount greater than the second capacity, and converting the local data into data stored in the form of a specified object array as the data to be reported.
[0117] Optionally, in a specific implementation manner, the method further includes:
[0118] When reporting the target array for the first time, reporting a first signal to the server indicating that data reporting is performed for the first time;
[0119] If after determining the target array, it is detected that there is data to be reported that has not been determined as the target array, then when reporting the target array to the server, a second signal for characterizing data reporting is reported to the server;
[0120] If after determining the target array, it is detected that there is no data to be reported that has not been determined as the target array, then when reporting the target array to the server, a third signal for characterizing the last data reporting is reported to the server.
[0121] Optionally, in a specific implementation manner, the method further includes:
[0122] When detecting a change in the running state, determining specified data with data updates; wherein, the data volume of the specified data is not greater than a second capacity of a data sending buffer of the target device;
[0123] Reporting the specified data and a fourth signal for characterizing data update to the server, so that after receiving the specified data and the fourth signal, the server uses the specified data to update the data stored in the device shadow of the target device, and sends a second response message to the target device;
[0124] Receiving the second response message.
[0125] In a fourth aspect, an embodiment of the present application provides a data transmission device, which is applied to a server in a data transmission system. The data transmission system further includes a target device, and the server is provided with a device shadow of the target device; the device includes:
[0126] A data determination module: configured to determine data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending-down notice for prompting the target device to send an incremental sending-down request to the target device, so that after receiving the data sending-down notice, the target device sends the incremental sending-down request to the server; wherein, the incremental sending-down request includes a first capacity of a data receiving buffer of the target device;
[0127] A request receiving module, configured to receive the incremental sending-down request, and determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data volumes is not greater than the first capacity according to the incremental sending-down request;
[0128] The array distribution module is used to, when there is no data to be distributed that has not been determined as the specified array, distribute the specified array carrying the specified identifier to the target device, so that the target device receives the specified array, processes the data of the specified array, and when it detects that the specified array carries the specified identifier, sends a distribution termination signal to the server to indicate that all the data to be distributed has been received; wherein, the specified identifier is used to indicate that after the specified array is distributed, there is no data to be distributed that has not been distributed by the server; when there is data to be distributed that has not been determined as the specified array, distribute the specified array to the target device, so that the target device receives the specified array, processes the data of the specified array, and when it detects that the specified array does not carry the specified identifier, send a new incremental distribution request to the server;
[0129] The signal receiving module is used to receive the distribution termination signal; or, receive the new incremental distribution request and return the step of determining, according to the incremental distribution request, a specified array in the data to be distributed that has not been distributed, where the sum of the first data amounts of which is not greater than the first capacity.
[0130] Optionally, in a specific implementation manner, the device further includes:
[0131] The identifier extraction module is used to, before sending a data distribution notification to the target device to prompt the target device to send an incremental distribution request, extract the array identifier of each array in the data to be distributed, and construct an identifier list based on the extracted array identifiers;
[0132] The request receiving module is specifically used for:
[0133] Traverse each array in the data to be distributed that has not been distributed in turn, starting from the first array in the data to be distributed that has not been distributed, according to the array arrangement order represented by the identifier list;
[0134] When traversing each array, calculate the sum of the first data amounts of the traversed array;
[0135] When the sum of the first data amounts is not greater than the first capacity, traverse the next array;
[0136] When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine all the arrays traversed, except the last array, as the specified array.
[0137] Optionally, in a specific implementation manner, the incremental distribution request further includes: the specified array identifier of the last received array;
[0138] The request receiving module is specifically configured to:
[0139] According to the array arrangement order represented by the identification list, starting from the array to which the next array identification of the specified array identification belongs, traverse each array in the data to be issued in sequence.
[0140] Optionally, in a specific implementation manner, the incremental issuance request further includes: a specified quantity;
[0141] The request receiving module is specifically configured to:
[0142] Traverse each array in the data to be issued that has not been issued; when traversing each array, determine the sum of the first data volumes of the traversed array and the number of the traversed array;
[0143] If the sum of the first data volumes is not greater than the first capacity and the number is less than the specified quantity, traverse the next array;
[0144] If the sum of the first data volumes is not greater than the first capacity and the number is equal to the specified quantity, stop traversing and determine the traversed arrays as the specified arrays;
[0145] If the sum of the first data volumes is greater than the first capacity and the number is not greater than the specified quantity, stop traversing and determine, among the traversed arrays, the arrays other than the last array as the specified arrays.
[0146] Optionally, in a specific implementation manner, the device further includes:
[0147] An array deletion module: used to delete the stored specified arrays.
[0148] Optionally, in a specific implementation manner, the incremental issuance request further includes: the target number of times for the target device to receive the specified arrays;
[0149] The array deletion module is specifically configured to:
[0150] Read the target number of times in the incremental issuance request and calculate the difference between the target number of times and 1; if the specified number of times for the server to currently record deleting the specified arrays is equal to the difference, delete the specified arrays determined most recently before receiving this incremental issuance request, and update the specified number of times to the sum value of the currently recorded specified number of times and 1; where the initial value of the specified number of times is 0;
[0151] After receiving the issuance termination signal, delete the specified arrays determined last time.
[0152] Optionally, in a specific implementation, the data determination module is specifically configured to:
[0153] Receive the expected attribute value of the target device sent by the user through the user terminal, and store the expected attribute value in the device shadow in the form of a specified object array as the data to be sent.
[0154] Optionally, in a specific implementation, the device further includes:
[0155] An identification receiving module: configured to receive the device identification of the target device, the specified information of the data to be reported, and a target identification array composed of the array identifiers of each array in the data to be reported sent by the target device after determining the data to be reported stored in the form of the specified object array; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0156] A notification reporting module: configured to send a data reporting notification for prompting the target device to report the data to be reported to the target device when the data information corresponding to the recorded device identification is inconsistent with the specified information, and / or, the identification array corresponding to the recorded device identification is inconsistent with the target identification array, so that after receiving the data reporting notification, the target device determines a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reports the target array to the server;
[0157] A target array receiving module, configured to receive the target array, store the target array in the device shadow of the target device and send a first response message to the server, so that the target device receives the first response message;
[0158] A target array determination module: configured to receive the target device to determine a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device when detecting that there is unreported data to be reported, and return to the step of receiving the target array.
[0159] Optionally, in a specific implementation, determining the data to be reported stored in the form of the specified object array includes:
[0160] Obtain local data to be reported and with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0161] Optionally, in a specific implementation, the device further includes:
[0162] A second signal receiving module, configured to receive a first signal, a second signal, or a third signal sent by the target device;
[0163] Wherein, the first signal is: when the target device reports the target array for the first time, a signal reported to the server for characterizing the first data reporting; the second signal is: when the target device determines the target array and detects that there is data to be reported that has not been determined as the target array, when reporting the target array to the server, a signal reported to the server for characterizing the data reporting; the third signal is: when the target device determines the target array and detects that there is no data to be reported that has not been determined as the target array, when reporting the target array to the server, a signal reported to the server for characterizing the last data reporting.
[0164] Optionally, in a specific implementation manner, the apparatus further includes:
[0165] A data receiving module: configured to receive specified data sent by the target device and a fourth signal for characterizing data update; wherein, the specified data is the specified data with data update determined by the target device when detecting a change in the running state, and the data volume of the specified data is not greater than the second capacity of the data sending buffer of the target device;
[0166] A data update module, configured to update the data stored in the device shadow of the target device by using the specified data, and send a second response message to the target device, so that the target device receives the second response message.
[0167] In a fifth aspect, an embodiment of the present application provides a data transmission apparatus, which is applied to a target device in a data transmission system, and the data transmission system further includes a server, and the server is provided with a device shadow of the target device; the apparatus includes:
[0168] A notification receiving module, configured to receive a data download notification; wherein, the data download notification is a notification sent by the server to the target device for prompting the target device to send an incremental download request after determining the data to be downloaded stored in the device shadow in the form of a specified object array;
[0169] A request sending module, configured to send the incremental distribution request to the server; wherein, the incremental distribution request includes a first capacity of a data reception buffer of the target device, so that after receiving the incremental distribution request, the server determines, according to the incremental distribution request, a specified array in the undistributed data to be distributed, the sum of the first data amounts of which is not greater than the first capacity, and if there is no undistributed data to be distributed that is not determined as the specified array, the server distributes the specified array carrying a specified identifier to the target device; otherwise, the server distributes the specified array to the target device; wherein, the specified identifier is used to indicate that after distributing the specified array, there is no undistributed data to be distributed on the server.
[0170] A data reception module: configured to receive the specified array and perform data processing on the specified array; when detecting that the specified array carries the specified identifier, send a distribution termination signal indicating that all the data to be distributed has been received to the server, so that the server receives the distribution termination signal; when detecting that the specified array does not carry the specified identifier, return to the step of sending the incremental distribution request to the server.
[0171] Optionally, in a specific implementation manner, the data to be distributed includes: expected attribute values of the target device sent by a user through a user terminal.
[0172] The data reception module is specifically configured to:
[0173] Perform attribute setting according to the specified array.
[0174] Optionally, in a specific implementation manner, the device further includes:
[0175] A data to be reported determination module, configured to determine data to be reported stored in the form of the specified object array, and send the device identifier of the target device, specified information of the data to be reported, and a target identifier array composed of array identifiers of each array in the data to be reported to the server, so that after receiving the device identifier, the specified information, and the target identifier array, if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or, the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, the server sends a data reporting notification for prompting the target device to report the data to be reported to the target device; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported.
[0176] The array reporting module is used to receive the data reporting notification; determine a target array in the to-be-reported data that has not been reported, where the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and report the target array to the server, so that after receiving the target array, the server stores the target array in the device shadow of the target device and sends a first response message to the server;
[0177] The message receiving module is used to receive the first response message; if it is detected that there is to-be-reported data that has not been reported, return to the step of determining a target array in the to-be-reported data that has not been reported, where the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device.
[0178] Optionally, in a specific implementation manner, the to-be-reported data determination module is specifically used for:
[0179] Obtain local data to be reported with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the to-be-reported data.
[0180] Optionally, in a specific implementation manner, the device further includes:
[0181] The signal reporting module is used to report a first signal indicating the first data reporting to the server when reporting the target array for the first time; if there is to-be-reported data that has not been determined as the target array after determining the target array, report a second signal indicating data reporting to the server when reporting the target array; if there is no to-be-reported data that has not been determined as the target array after determining the target array, report a third signal indicating the last data reporting to the server when reporting the target array.
[0182] Optionally, in a specific implementation manner, the device further includes:
[0183] The specified data determination module is used to determine specified data with data updates when detecting a change in the running state; where the data amount of the specified data is not greater than the second capacity of the data sending buffer of the target device;
[0184] The fourth signal reporting module is used to report the specified data and a fourth signal indicating data update to the server, so that after receiving the specified data and the fourth signal, the server uses the specified data to update the data stored in the device shadow of the target device and sends a second response message to the target device;
[0185] A response message receiving module, configured to receive the second response message.
[0186] In a sixth aspect, an embodiment of the present application provides a server, including:
[0187] A memory, configured to store a computer program;
[0188] A processor, configured to implement any of the method steps of the data transmission provided in the second aspect when executing the program stored in the memory.
[0189] In a seventh aspect, an embodiment of the present application provides an electronic device, including:
[0190] A memory, configured to store a computer program;
[0191] A processor, configured to implement any of the method steps of the data transmission provided in the third aspect when executing the program stored in the memory.
[0192] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, it implements any of the method steps of the data transmission provided in the second aspect and / or any of the method steps of the data transmission provided in the third aspect.
[0193] In a ninth aspect, an embodiment of the present application further provides a computer program product including instructions, which when running on a computer, causes the computer to execute any of the method steps of the data transmission provided in the second aspect and / or any of the method steps of the data transmission provided in the third aspect.
[0194] Advantageous effects of the embodiments of the present application:
[0195] As can be seen above, when applying the solution provided by the embodiments of the present application, during the process of the server sending data to the target device, after determining the data to be sent that is stored in the device shadow in the form of a specified object array, the server can send a data sending notification to the target device to prompt the target device to send an incremental sending request; after receiving the data sending notification, the target device sends an incremental sending request to the server, and the incremental sending request includes the first capacity of the data receiving buffer of the target device; furthermore, after receiving the incremental sending request, the server can, according to the incremental sending request, determine a specified array in the data to be sent that has not been sent, where the sum of the first data amounts is not greater than the first capacity, and then send the specified array to the target device; the target device receives the specified array, processes the data in the specified array, and then returns to the step of sending an incremental sending request to the server. If, after determining a specified array in the data to be sent that has not been sent, where the sum of the first data amounts is not greater than the first capacity, according to the incremental sending request, there is no data to be sent in the server that has not been determined as the specified array, the server can send a specified array carrying a specified identifier to the target device, and the specified identifier is used to indicate that there is no data to be sent in the server after sending the specified array; furthermore, after receiving the specified array and processing the data in the specified array, if the target device detects that the specified array carries the specified identifier, it can determine that all the data to be sent has been received, and then can send a sending termination signal to the server to indicate that all the data to be sent has been received; the server receives the sending termination signal, and the data sending process ends.
[0196] Based on this, when applying the solution provided by the embodiments of the present application, when the amount of data to be sent from the server to the target device is greater than the first capacity of the data receiving buffer of the target device, the server can adopt an incremental sending method to send the data to be sent to the target device in batches in the form of a specified object array, and moreover, the amount of data in each specified array sent to the target device is not greater than the above-mentioned first capacity. In this way, since each time the data is sent in the form of a specified object array, the target device can immediately process the data in the specified array after receiving the specified array to avoid occupying the space of the data receiving buffer, and furthermore, it is convenient to receive the next specified array sent by the server. Therefore, the solution provided by the embodiments of the present application can solve the problem of data receiving buffer overflow of the device caused by the server sending data with an amount greater than the capacity of the device's data receiving buffer without increasing the device cost.
[0197] In addition, since the target device can immediately process the specified array every time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be sent and then process the integrated array. Therefore, there is no need to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be sent can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0198] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.
[0199] Figure 1 Schematic structural diagram of a data transmission system provided by an embodiment of the present application;
[0200] Figure 2 First information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0201] Figure 3 Another schematic structural diagram of a data transmission system provided by an embodiment of the present application;
[0202] Figure 4 Second information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0203] Figure 5 Third information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0204] Figure 6 Fourth information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0205] Figure 7 Fifth information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0206] Figure 8 Sixth information interaction diagram of a data transmission system provided by an embodiment of the present application;
[0207] Figure 9 Schematic flowchart of a data transmission method provided by an embodiment of the present application;
[0208] Figure 10 Another schematic flowchart of a data transmission method provided by an embodiment of the present application;
[0209] Figure 11 The structural schematic diagram of a data transmission device provided by an embodiment of the present application;
[0210] Figure 12 The structural schematic diagram of another data transmission device provided by an embodiment of the present application;
[0211] Figure 13 The structural schematic diagram of a server provided by an embodiment of the present application;
[0212] Figure 14 The structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0213] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.
[0214] In the related art, the problem of data reception buffer overflow is reduced by increasing the data reception buffer capacity of the Internet of Things device. However, increasing the data reception buffer capacity will increase the cost of the Internet of Things device, and after increasing the data reception buffer capacity, the data that the data reception buffer can receive is still limited, and it may be necessary to increase the data reception buffer capacity again.
[0215] To solve the above problems, an embodiment of the present application provides a data transmission system, which includes a target device and a server, wherein the server is provided with a device shadow of the target device.
[0216] The so-called device shadow of the target device is a data file stored in the server, which is a virtual mapping of the target device in the server and can be used to record the relevant data of the target device.
[0217] Among them, the system is applicable to various scenarios where the server issues data to the device by means of the device shadow of the device, and the device reports data to the server to update its own device shadow in the server. For example, data transmission between an Internet of Things device and a cloud server provided with the device shadow of the Internet of Things device. Based on this, the embodiment of the present application does not specifically limit the application scenario of the system.
[0218] Moreover, the server can provide a shadow service by setting the device shadow of the target device, and the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server, but is not limited thereto.
[0219] The target device can be an Internet of Things device such as a mobile phone, a gateway, or a smart home appliance, or any device that can perform data transmission with a server. In this regard, the embodiments of the present application do not make specific limitations.
[0220] Among them, in a data transmission system provided by the embodiments of the present application:
[0221] The server is configured to determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending notification for prompting the target device to send an incremental sending request to the target device;
[0222] The target device is configured to receive the data sending notification and send the incremental sending request to the server; wherein, the incremental sending request includes a first capacity of the data receiving buffer of the target device.
[0223] The server is further configured to receive the incremental sending request; according to the incremental sending request, determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity; if there is no data to be sent down that has not been determined as the specified array, send the specified array carrying a specified identifier to the target device; otherwise, send the specified array to the target device; wherein, the specified identifier is used to indicate that after the specified array is sent down, there is no data to be sent down that has not been sent down by the server.
[0224] The target device is further configured to receive the specified array and perform data processing on the specified array; if it is detected that the specified array carries the specified identifier, send a sending termination signal for indicating that all the data to be sent down has been received to the server, otherwise, return to the step of sending the incremental sending request to the server.
[0225] The server is further configured to receive the sending termination signal.
[0226] As can be seen above, when applying the solution provided by the embodiments of the present application, during the process of the server sending data to the target device, after determining the data to be sent that is stored in the device shadow in the form of a specified object array, the server can send a data sending notification to the target device to prompt the target device to send an incremental sending request; after receiving the data sending notification, the target device sends an incremental sending request to the server, and the incremental sending request includes the first capacity of the data receiving buffer of the target device; furthermore, after receiving the incremental sending request, the server can, according to the incremental sending request, determine a specified array in the data to be sent that has not been sent, where the sum of the first data amounts is not greater than the first capacity, and then send the specified array to the target device; the target device receives the specified array, processes the data in the specified array, and then returns to the step of sending an incremental sending request to the server. If, after determining a specified array in the data to be sent that has not been sent, where the sum of the first data amounts is not greater than the first capacity, according to the incremental sending request, there is no data to be sent in the server that has not been determined as the specified array, the server can send a specified array carrying a specified identifier to the target device, and the specified identifier is used to indicate that there is no data to be sent in the server after sending the specified array; furthermore, after receiving the specified array and processing the data in the specified array, if the target device detects that the specified array carries the specified identifier, it can determine that all the data to be sent has been received, and then can send a sending termination signal to the server to indicate that all the data to be sent has been received; the server receives the sending termination signal, and the data sending process ends.
[0227] Based on this, when applying the solution provided by the embodiments of the present application, when the amount of data to be sent by the server to the target device is greater than the first capacity of the data receiving buffer of the target device, the server can adopt an incremental sending method to send the data to be sent to the target device in batches in the form of a specified object array, and moreover, the amount of data in each specified array sent to the target device is not greater than the above-mentioned first capacity. In this way, since each time the data is sent in the form of a specified object array, the target device can immediately process the data in the specified array after receiving the specified array to avoid occupying the space of the data receiving buffer, and furthermore, it is convenient to receive the next specified array sent by the server. Therefore, the solution provided by the embodiments of the present application can solve the problem of data receiving buffer overflow of the device caused by the server sending data with an amount greater than the capacity of the device's data receiving buffer without increasing the device cost.
[0228] In addition, since the target device can immediately process the data of the specified array every time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be sent, and then process the data of the integrated array. Therefore, there is no need to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be sent can be effectively improved.
[0229] Next, a data transmission system provided by an embodiment of the present application will be specifically described with reference to the accompanying drawings.
[0230] Figure 1 It is a schematic structural diagram of a data transmission system provided by an embodiment of the present application. As Figure 1 shown, the system may include: a server 101 and a target device 102. Among them, a device shadow of the target device 102 is set in the server 101.
[0231] The server 101 is configured to determine the data to be sent stored in the device shadow in the form of a specified object array, and send a data sending notification for prompting the target device to send an incremental sending request to the target device.
[0232] The target device 102 is configured to receive the data sending notification and send the incremental sending request to the server; wherein, the incremental sending request includes the first capacity of the data receiving buffer of the target device.
[0233] The server 101 is further configured to receive the incremental sending request; determine a specified array in the data to be sent that has not been sent, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending request; if there is no data to be sent that has not been determined as a specified array, send a specified array carrying a specified identifier to the target device; otherwise, send a specified array to the target device; wherein, the specified identifier is used to indicate that after the specified array is sent, there is no data to be sent that has not been sent by the server.
[0234] The target device 102 is further configured to receive the specified array and process the data of the specified array; if it is detected that the specified array carries a specified identifier, send a sending termination signal indicating that all the data to be sent has been received to the server, otherwise, return to the step of sending an incremental sending request to the server.
[0235] The server 101 is further configured to receive the sending termination signal.
[0236] As Figure 1 shown, there is a communication connection between the server 101 and the target device 102 in the embodiment of the present application. Among them, the communication connection method may be various communication connection methods such as 5G, WIFI, and wired, all of which are reasonable.
[0237] Next, in combination with the information interaction process between the server 101 and the target device 102 in the above data transmission system, a data transmission system provided by an embodiment of the present application will be specifically described. Figure 1 A data transmission system provided by an embodiment of the present application as shown will be specifically described.
[0238] Figure 2 FIG. 6 is a first information interaction schematic diagram of a data transmission system provided by an embodiment of the present application. As Figure 2 shown, the information interaction process between the server 101 and the target device 102 in this data transmission system may include the following steps S201-S210.
[0239] S201: The server 101 determines the data to be sent down stored in the device shadow in the form of a specified object array.
[0240] The server 101 may determine the data to be sent down stored in the device shadow in the form of a specified object array.
[0241] Optionally, in a specific implementation manner, the server may receive the desired attribute value of the target device sent by the user through the user terminal, and store the desired attribute value in the device shadow in the form of a specified object array as the data to be sent down.
[0242] Exemplarily, as Figure 3 shown, the device shadow of the target device 102 in the server 101 is provided with a desired area, and this desired area may store the desired attribute value of the target device 102, that is, the desired attribute value. The user may set and send the desired attribute value of the target device 102 through the user terminal. The server 101 may receive the desired attribute value, store the desired attribute value in the desired area of the device shadow of the target device 102 in the form of a specified object array, and determine the desired attribute value as the data to be sent down.
[0243] Optionally, in a specific implementation manner, the above specified object array may be a JSON object array.
[0244] S202: The server 101 sends a data sending-down notice for prompting the target device 102 to send an incremental sending-down request to the target device 102.
[0245] After determining the data to be sent down, the server 101 may send a data sending-down notice to the target device 102, and this data sending-down notice may be used to prompt the target device 102 to send an incremental sending-down request to the server 101.
[0246] S203: The target device 102 receives the data sending-down notice.
[0247] S204: The target device 102 sends an incremental download request to the server 101.
[0248] Among them, the incremental download request includes the first capacity of the data reception buffer of the target device 102.
[0249] The target device 102 can receive the data download notification sent by the server 101, and after receiving the data download notification, send an incremental download request to the server 101, and the incremental download request carries the first capacity of the data reception buffer of the target device 102.
[0250] S205: The server 101 receives the incremental download request, and according to the incremental download request, determines a specified array in the undownloaded data to be downloaded, where the sum of the first data amounts is not greater than the first capacity.
[0251] The server 101 can receive the incremental download request sent by the target device 102, and then according to the incremental download request, determine a specified array in the undownloaded data to be downloaded, that is to say, the data amount of the specified array is not greater than the capacity of the data reception buffer of the target device 102.
[0252] S206: If there is no undownloaded data to be downloaded in the server 101 that has not been determined as the specified array, then the specified array with the specified identifier is downloaded; otherwise, the specified array is downloaded.
[0253] Among them, the specified identifier is used to indicate that after the specified array is downloaded, there is no undownloaded data to be downloaded in the server 101.
[0254] After determining the above-mentioned specified array, the server 101 can further detect whether there is undownloaded data to be downloaded that has not been determined as the specified array.
[0255] Among them, if the server 101 detects that there is no undownloaded data to be downloaded that has not been determined as the specified array, it means that except for the specified array determined this time, all other arrays in the data to be downloaded have been downloaded to the target device 102. Furthermore, the specified array with the specified identifier can be downloaded to the target device 102 to inform the target device 102 that after the specified array determined this time is downloaded, there will be no undownloaded data to be downloaded in the server 101;
[0256] If the server 101 detects that there is undelivered data that has not been determined as the specified array, it indicates that in addition to the specified array determined this time, there is still undelivered data in the undelivered data that has not been sent to the target device 102. Furthermore, the target device 102 can send an incremental delivery request again to request the undelivered data that has not been sent in the server 101. Therefore, when the server 101 delivers the specified array determined this time, it can directly deliver the specified array determined this time without carrying the above-mentioned specified identifier in the specified array determined this time.
[0257] S207: The target device 102 receives the specified array and processes the data in the specified array;
[0258] The target device 102 can receive the specified array sent by the server 101 and process the data in the specified array.
[0259] Optionally, in a specific implementation, if the specified array received by the target device 102 is the expected attribute value of the target device 102, the data processing of the specified array by the target device 102 can be: the target device 102 sets the attributes according to the specified array. Based on this, the target device 102 can set its own attributes according to the received expected attribute value.
[0260] S208: If the specified array carries the specified identifier, the target device 102 sends a delivery termination signal to the server 101 to indicate that all undelivered data has been received.
[0261] S209: If the specified array does not carry the specified identifier, the target device 102 returns to step S204.
[0262] S210: The server 101 receives the delivery termination signal.
[0263] When the target device 102 receives the specified array sent by the server 101, it can detect whether the received specified array carries the above-mentioned specified identifier, so as to determine whether to send the above-mentioned incremental delivery request to the server 101 according to the detection result.
[0264] Optionally, the target device 102 can simultaneously process the data in the received specified array and detect whether the received specified array carries the above-mentioned specified identifier; it can also first process the data in the received specified array and then detect whether the received specified array carries the above-mentioned specified identifier after the data processing is completed; it can also first detect whether the received specified array carries the above-mentioned specified identifier and then process the data in the received specified array after obtaining the detection result; all of these are reasonable.
[0265] In this way, if the target device 102 detects that the received specified array carries the specified identifier, it can determine that the server 101 has sent all the data to be sent, and thus, it can be determined that the target device 102 has received all the data to be sent. Therefore, the target device 102 can send a termination signal for indicating that all the data to be sent has been received to the server 101. At this time, the server 101 can receive the termination signal sent by the target device 102. Thus, the data sending process ends.
[0266] If the target device 102 detects that the received specified array does not carry the specified identifier, it can determine that there is still data to be sent in the server 101 that has not been sent. Thus, it can be determined that the target device 102 can send a new incremental sending request to the server 101 to request the data to be sent in the server 101 that has not been sent. Therefore, the target device 102 can return to step S204 and continue to send an incremental sending request to the server 101, so that after the server 101 receives the incremental sending request again, it sends the specified array to the target device 102. This cycle continues until the target device 102 detects that the received specified array carries the specified identifier and sends a termination signal to the server 101, thereby completing the data sending process.
[0267] As can be seen from the above, when applying the solution provided by the embodiment of the present application, when the amount of data to be sent from the server to the target device is greater than the first capacity of the data reception buffer of the target device, the server can adopt an incremental sending method to send the data to be sent to the target device in batches in the form of a specified object array, and moreover, the amount of data of each specified array sent to the target device is not greater than the above first capacity. In this way, since each time the data is sent in the form of a specified object array, the target device can immediately process the data in the specified array after receiving it, so as to avoid occupying the space of the data reception buffer. Furthermore, it is convenient to receive the specified array sent by the server next time. Therefore, the solution provided by the embodiment of the present application can solve the problem of data reception buffer overflow of the device caused by the server sending data with an amount greater than the capacity of the data reception buffer of the device without increasing the device cost.
[0268] In addition, since the target device can immediately process the specified array each time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be sent and then process the integrated array. Thus, it is not necessary to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be sent can be effectively improved.
[0269] Since the data to be sent down is stored in Server 101 in the form of an array of specified objects, the data to be sent down includes multiple arrays. Each array usually can include an array identifier and data content, and the array identifier of each array corresponds uniquely to that array. Optionally, the above array identifier can be the id field of the array.
[0270] Based on this, optionally, in a specific implementation, before the server 101 sends a data sending notice to the target device 102 for prompting the target device 102 to send an incremental sending request, it can also extract the array identifier of each array in the data to be sent down, and based on the extracted array identifiers of each array, construct an identifier list.
[0271] Correspondingly, in this specific implementation, when the server 101 determines specified arrays whose sum of the first data amounts in the data to be sent down that has not been sent down is not greater than the first capacity according to the incremental sending request, it can include the following steps 11 - 14:
[0272] Step 11: Starting from the first array in the data to be sent down that has not been sent down, traverse each array in the data to be sent down that has not been sent down in sequence according to the array arrangement order represented by the identifier list.
[0273] Step 12: When traversing each array, calculate the sum of the first data amounts of the traversed array.
[0274] Step 13: When the sum of the first data amounts is not greater than the first capacity, traverse the next array.
[0275] Step 14: When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine the other arrays except the last array among the traversed arrays as specified arrays.
[0276] In this specific implementation, the server 101 can determine the arrangement order of each array identifier in the above identifier list as the arrangement order of the arrays corresponding to each array identifier in the data to be sent down. Thus, when the server 101 determines specified arrays, it can, according to the array arrangement order represented by the above identifier list, determine each array in the data to be sent down as a specified array in sequence.
[0277] In this way, when the server 101 receives an incremental sending request, it can determine the first data to be sent down that has not been sent down and is arranged in the first place according to the array arrangement order represented by the above identifier list. Thus, the server can start from the first array in the data to be sent down that has not been sent down and traverse each array in the data to be sent down that has not been sent down in sequence according to the array arrangement order represented by the identifier list.
[0278] Furthermore, in order to ensure that the sum of the first data amounts of the determined specified arrays does not exceed the first capacity of the data reception buffer of the target device 102, when traversing each array, the sum of the first data amounts of the currently traversed arrays can be calculated, and it can be determined whether the calculated sum of the first data amounts does not exceed the first capacity.
[0279] Among them, if the sum of the first data amounts does not exceed the first capacity, the server 101 can continue to traverse the next array;
[0280] If the sum of the first data amounts is greater than the first capacity, it indicates that the arrays traversed cannot be sent to the target device 102 at one time. Moreover, among the arrays traversed, the sum of the data amounts of the arrays other than the last array does not exceed the first capacity. Therefore, among the arrays traversed, the arrays other than the last array are the arrays with the largest data amount that can be sent to the target device 102 currently. In this way, the traversal can be stopped, and the arrays other than the last array among the arrays traversed can be determined as the specified arrays.
[0281] Exemplarily, according to the arrangement order of the arrays represented by the identifier list, the arrangement order of the arrays in the to-be-sent data that has not been sent is: Array 1, Array 2, Array 3, and Array 4. The server 101 starts traversing from Array 1. When traversing Array 1, it is obtained that the data amount of Array 1 is less than the first capacity, and then continues to traverse Array 2. It is calculated that the sum of the data amounts of Array 1 and Array 2 is less than the first capacity, and then continues to traverse Array 3. It is calculated that the sum of the data amounts of Array 1, Array 2, and Array 3 is equal to the first capacity, and then continues to traverse Array 4. It is calculated that the sum of the data amounts of Array 1, Array 2, Array 3, and Array 4 is greater than the first capacity. Then the traversal is stopped, and Array 1, Array 2, and Array 3 are determined as the specified arrays.
[0282] Based on this, by applying the solution provided in the embodiment of the present application, the server 101 can determine the specified arrays based on the order determined by the array identifier of each array in the to-be-sent data, and the data amount of the determined specified arrays does not exceed the first capacity of the data reception buffer of the target device 102.
[0283] Optionally, in a specific implementation manner, the incremental sending request sent by the target device 102 to the server 101 may further include the specified array identifier of the last array received. Furthermore, step 11 above, according to the arrangement order of the arrays represented by the identifier list, starting from the first array in the to-be-sent data that has not been sent, sequentially traversing each array in the to-be-sent data that has not been sent, may include the following steps 111:
[0284] Step 111: Starting from the array to which the next array identifier of the specified array identifier belongs, traverse each array in the data to be sent in sequence according to the array arrangement order represented by the identifier list.
[0285] Optionally, when the server 101 sends a specified array to the target device 102, the specified array sent is determined according to the array arrangement order represented by the above identifier list, and the specified array sent includes the array identifiers of each array. Therefore, when the target device 102 sends an incremental sending request to the server 101, the incremental sending request may include the specified array identifier of the last array received by the target device 102.
[0286] In this way, when the server 101 receives the incremental sending request sent by the target device 102, it can determine the specified array identifier in the received incremental sending request, and further, it can determine that the specified array identifier is the array identifier of the last array among the arrays sent. Thus, the server 101 can determine that in the array arrangement order represented by the above identifier list, the array corresponding to the next array identifier of the above specified array identifier is the first array in the data to be sent that has not been sent. Therefore, the server 101 can start from the array to which the next array identifier of the specified array identifier belongs and traverse each array in the data to be sent in sequence according to the array arrangement order represented by the identifier list.
[0287] In some cases, when the target device 102 requests the data to be sent from the server 101, in order to further ensure that the amount of data sent by the server 101 each time does not exceed the above first capacity, the number of data sent by the server 101 each time can be restricted.
[0288] Based on this, optionally, in a specific implementation, the incremental sending request sent by the target device 102 to the server 101 may further include a specified quantity.
[0289] Correspondingly, in this specific implementation, when the server 101 determines the specified array whose sum of the first data amounts in the data to be sent that has not been sent does not exceed the first capacity according to the incremental sending request, it may include the following steps 21-24:
[0290] Step 21: Traverse each array in the data to be sent that has not been sent; when traversing each array, determine the sum of the first data amounts of the traversed array and the number of the traversed array.
[0291] Step 22: If the sum of the first data amounts does not exceed the first capacity and the number is less than the specified quantity, traverse the next array.
[0292] Step 23: If the sum of the first data amounts is not greater than the first capacity and the quantity is equal to the specified quantity, stop traversing and determine each traversed array as the specified array.
[0293] Step 24: If the sum of the first data amounts is greater than the first capacity and the quantity is not greater than the specified quantity, stop traversing and determine, among each traversed array, all arrays except the last array as the specified array.
[0294] In this specific implementation manner, when the server 101 traverses each array in the undistributed data to be distributed to determine the specified array, each time an array is traversed, the server 101 can first determine the sum of the first data amounts of the traversed array and the quantity of the traversed array. Furthermore, the numerical relationship between the sum of the first data amounts and the first capacity, and the numerical relationship between the quantity and the specified quantity can be determined.
[0295] Among them, if the sum of the first data amounts is not greater than the first capacity and the quantity is less than the specified quantity, the server 101 can continue to traverse the next array;
[0296] If the sum of the first data amounts is not greater than the first capacity and the quantity is equal to the specified quantity, it can be determined that the quantity of the array traversed at this time has met the quantity of arrays that can be distributed at one time restricted by the target device 102. If the next array is continued to be traversed, regardless of whether the sum of the first data amounts of the traversed array is greater than the first capacity, the quantity of the traversed arrays will exceed the quantity of arrays that can be distributed at one time restricted by the target device 102. Thus, distribution cannot be achieved. Therefore, the server 101 can stop traversing and determine each traversed array as the specified array;
[0297] If the sum of the first data amounts is greater than the first capacity and the quantity is not greater than the specified quantity, it can be determined that the quantity of the array traversed at this time has exceeded the first capacity. Furthermore, among each traversed array, the sum of the data amounts of all arrays except the last array is not greater than the first capacity, and among each traversed array, the quantity of all arrays except the last array is not greater than the specified quantity. Therefore, among each traversed array, all arrays except the last array are the arrays with the largest data amount that can be currently distributed to the target device 102. In this way, traversing can be stopped and all arrays except the last array among each traversed array can be determined as the specified array.
[0298] Exemplarily, the above-specified quantity can be 3, and the first capacity can be 64k. Further, the server 101 traverses each array in the data to be distributed that has not been distributed. After traversing the first array, it determines that the data volume of the first array is 15k, the number of arrays traversed is 1, 15k is less than 64k, and 1 is less than 3. The server 101 traverses the next array; after traversing the second array, it determines that the sum of the first data volumes of the first array and the second array is 36k, the number of arrays traversed is 2, 36k is less than 64k, and 2 is less than 3. The server 101 traverses the next array; after traversing the third array, it determines that the sum of the first data volumes of the first array, the second array, and the third array is 60k, the number of arrays traversed is 3, 60k is less than 64k, and 3 is equal to 3. That is, the sum of the first data volumes is less than the first capacity, and the quantity is equal to the specified quantity. At this time, the server 101 stops traversing and determines the first array, the second array, and the third array traversed as the specified arrays.
[0299] To save the storage space of the server 101, after the server 101 distributes the specified arrays to the target device 102, it can usually delete the stored specified arrays.
[0300] Optionally, in a specific implementation manner, the server 101 can also delete the stored specified arrays.
[0301] In this specific implementation manner, after the server 101 distributes the determined specified arrays to the target device 102, the specified arrays that have been distributed to the target device 102 in the server 101 can lose their application value for the server 101. Therefore, the server 101 can delete the specified arrays that have been distributed to the target device 102, thereby releasing its own storage space.
[0302] Optionally, in a specific implementation manner, the incremental distribution request sent by the target device 102 to the server 101 can also include the target number of times for the target device 102 to receive the specified arrays.
[0303] Correspondingly, in this specific implementation manner, for the server 101 to delete the stored specified arrays, it can include the following steps 31-32:
[0304] Step 31: Read the target number of times in the incremental distribution request and calculate the difference between the target number of times and 1; if the specified number of times for the server 101 to delete the specified arrays currently recorded is equal to this difference, then delete the specified arrays determined most recently before receiving this incremental distribution request, and update the specified number of times to the sum of the currently recorded specified number of times and 1.
[0305] Among them, the initial value of the specified number of times is 0.
[0306] In this specific implementation manner, the target number in the incremental download request sent by the target device 102 to the server 101 is the number of times the target device 102 receives the specified array, and the specified number currently recorded by the server 101 is the number of times the server deletes the specified array that has been downloaded.
[0307] When the server 101 receives the incremental download request sent by the target device 102, it can determine the target number in the received incremental download request, further calculate the difference between the determined target number and 1, and then determine the numerical relationship between the calculated difference and the specified number recorded by itself.
[0308] Among them, if the above-mentioned specified number is equal to the above-mentioned difference, it indicates that before the server 101 received the incremental download request this time, the last determined specified array has been sent to the target device 102, and the target device 102 has received the specified array. Therefore, the server 101 can delete the last determined specified array before receiving the incremental download request this time, and update the number of times the specified array is deleted, that is, update the specified number to the sum of the currently recorded specified number and 1.
[0309] That is to say, after receiving the incremental download request sent by the target device 102, the server 101 can delete the specified array sent to the target device 102 last time based on the target number of times the target device 102 receives the specified array carried in the incremental download request.
[0310] If the above-mentioned specified number is not equal to the above-mentioned difference, it can indicate that before the server 101 received the incremental download request this time, the last determined specified array was not successfully sent to the target device 102, or the server 101 has not sent the specified array to the target device 102 before receiving the incremental download request this time. For example, when the target device 102 sends the incremental download request to the server 101 for the first time, the target number in the sent incremental download request is 0, and the specified number recorded by the server 101 is also 0; therefore, in the case where the above-mentioned specified number is not equal to the above-mentioned difference, the server 101 will not perform the data deletion operation, and the server 101 does not update the recorded specified number.
[0311] Step 32: After receiving the download termination signal, delete the last determined specified array.
[0312] The termination signal sent by the target device 102 to the server 101 after receiving all the data to be sent. That is to say, when the server 101 receives the termination signal, it can be determined that the target device 102 has received all the data to be sent, and the data sending process ends. Furthermore, after receiving the termination signal, the server 101 can delete the specified array determined last time.
[0313] Based on this, after successfully sending the specified array to the target device 102 each time, the server 101 can delete the successfully sent specified array and release the data storage space occupied by the successfully sent specified array to save data storage resources.
[0314] In addition, since the server 101 deletes the successfully sent specified array only after successfully sending the specified array to the target device 102 each time, if the target device 102 fails to receive the specified array due to network anomalies or packet loss, etc., the specified array in the server 101 will not be deleted either. Furthermore, it can retry sending the specified array or wait until the network is normal before sending the specified array. In this way, it is possible to avoid data loss and data sending failure caused by network anomalies or packet loss, etc.
[0315] To facilitate understanding of the process of the server 101 sending data to the target device 102 in the data transmission system provided in the embodiment of the present application above, the following uses a specific example to illustrate the process of the server 101 sending data to the target device 102.
[0316] As Figure 4 shown, in the data transmission system provided in the embodiment of the present application, the process of the server 101 sending data to the target device 102 may include the following steps 401 - step 4015.
[0317] Among them, Figure 4 the device is used to indicate the target device, and the shadow service is used to indicate the server that provides the shadow service for the device.
[0318] Step 401: The user sets the expected status value in full through the mobile phone APP.
[0319] The user can set the expected status value of the device through the user terminal, such as the mobile phone APP, and the shadow service can receive the expected status value of the device set by the user.
[0320] Step 402: The shadow service stores the expected status value, and the data structure is an array of JSON objects.
[0321] After receiving the expected status value set by the user, the shadow service can store the expected status value in the device shadow of the device in the form of an array of JSON objects.
[0322] Step 403: The shadow service notifies the device to synchronize the expected status value.
[0323] The shadow service can extract the id field of each array in the expected status value JSON object array to form a primary key id list, and send a data download notification to the device to prompt the device to send an incremental download request, so as to notify the device to synchronize the expected status value.
[0324] Step 404: The device sends an incremental synchronization request to the shadow service: page: 0, pageSize: 5, lastIndex: 0, threshold: 64k.
[0325] Among them, page is used to indicate the target number of times the device receives a specified array, pagesize is used to indicate the maximum number of arrays the device expects to obtain, lastindex is used to indicate the id of the last array received by the device, and threshold is used to indicate the data reception buffer capacity of the device.
[0326] Furthermore, page = 0 means that the device has currently received the specified array 0 times, pageSize = 5 means that the number of arrays the device expects to obtain does not exceed 5, lastIndex = 0 means that the id of the last array received by the device is 0, and threshold = 64k means that the data reception buffer capacity of the device is 64k.
[0327] Step 405: The shadow service determines that lastPage is not equal to page - 1, does not delete data, and records lastPage = 0.
[0328] Among them, lastPage is the number of times the shadow service records deleting the specified array, and the initial value of lastPage is 0.
[0329] Since in the above incremental synchronization request, page = 0, therefore, the shadow service can determine that page - 1 is not equal to lastPage and does not delete data.
[0330] Step 406: The shadow service issues a response message, containing 4 pieces of data, not exceeding 64k, hasNext; 1.
[0331] The shadow service reads an array of JSON objects. Starting from the position where the array id = lastIndex + 1, that is, starting from the array with id = 1, it traverses the array. When traversing the array with id = 5, it calculates that the sum of the data volumes of the five traversed arrays is greater than 64k. Furthermore, the shadow service determines the arrays with id = 1, id = 2, id = 3, and id = 4 as the specified arrays and sends these four arrays to the device. Since there is still data to be sent in the shadow service that has not been sent to the device, hasNext = 1 in the sent response message.
[0332] Step 407: The device sends an incremental synchronization request, page: 1, pageSize: 5, lastIndex: 4, threshold: 64k.
[0333] After receiving the 4 arrays sent by the shadow service, the device updates its local status based on these 4 arrays and sends another incremental synchronization request to the server: page: 1, pageSize: 5, lastIndex: 4, threshold: 64K. Here, page = 1 means the device has received the specified arrays 1 time currently, pageSize = 5 means the maximum number of arrays the device expects to obtain is 5, lastIndex = 4 indicates that the id of the last array received by the device is 4, and threshold = 64k means the data reception buffer capacity of the device is 64k.
[0334] Step 408: The shadow service determines that lastPage is equal to page - 1, deletes the previously sent object array, and records lastPage = 1.
[0335] Since lastPage = 0, page = 1, page - 1 = 0, and lastPage is equal to page - 1, the shadow service deletes the previously sent object array and records lastPage = 1.
[0336] Step 409: The shadow service sends a response message containing 3 pieces of data, not exceeding 64k, hasNext: 1.
[0337] The shadow service continues to read the array of JSON objects. Starting from the position where the array id = lastIndex + 1, that is, starting from the array with id = 5, it traverses the array. When traversing the array with id = 8, it calculates that the sum of the data volumes of the four traversed arrays is greater than 64k. Furthermore, the shadow service determines the arrays with id = 5, id = 6, and id = 7 as the specified arrays and sends these three arrays to the device. Since there is still data to be sent in the shadow service that has not been sent to the device, hasNext = 1 in the sent response message.
[0338] Step 4010: Repeat Step 407, Step 408, and Step 409.
[0339] Step 4011: Device incremental synchronization request, page: n, pageSize: 5, lastIndex: m, threshold: 64K.
[0340] After the device receives the array sent by the shadow service, it updates the local status according to the sent array and sends an incremental synchronization request to the server again: page: n, pageSize: 5, lastIndex: m, threshold: 64K. Here, page = n means the device has received the specified array n times currently, pageSize = 5 means the maximum number of arrays the device expects to obtain is 5, lastIndex = m indicates that the id of the last array received by the device is m, and threshold = 64k means the data reception buffer capacity of the device is 64k.
[0341] Step 4012: lastPage is equal to page - 1, the shadow service deletes the previously sent object array, and records lastPage = n.
[0342] The shadow service determines that lastPage is equal to page - 1, deletes the previously sent object array, and records lastPage = n.
[0343] Step 4013: The shadow service sends a response message, containing 2 pieces of data, not exceeding 64K, hasNext: 0.
[0344] The shadow service continues to read the JSON object array, starting from the array id = lastIndex + 1, that is, starting from the array id = m + 1, and traverses the array. When traversing to the array with id = m + 2, it calculates that the sum of the data volumes of the four traversed arrays is less than 64k, determines that there is no pending data in the shadow service that has not been sent to the device, and further, the shadow service determines the arrays with id = m + 1 and id = m + 2 as the specified arrays and sends these two arrays to the device. Since there is no pending data in the shadow service that has not been sent to the device, hasNext = 0 in the sent response message.
[0345] Step 4014: The device notifies the shadow service that all data has been received, pageSize: 0.
[0346] The device receives the arrays with d = m + 1 and id = m + 2 sent by the shadow service. According to the signal of hasNext = 0, it determines that all the pending data has been received, and sends a termination signal for sending pagesize: 0 to the shadow service, notifying the shadow service that all the expected status values have been received.
[0347] Step 4015: The shadow service deletes the previously issued object array, and the process ends.
[0348] The shadow service receives the termination signal for data issuance sent by the device, and deletes the previously issued specified array. Thus, the data issuance process ends.
[0349] Based on the method provided in the embodiments of the present application, the server can obtain the capacity of the data reception buffer of the target device. The server issues the expected attribute values to the device in batches according to the capacity of the target device's data reception buffer; the expected status values issued each time are independent and complete JSON status arrays and have no dependence on subsequent data. Therefore, the target device can process some of the received expected status values. Thus, when the reception buffer of the target device is limited, incremental issuance can be used to enable the target device to receive data larger than the buffer size, and the problem of data reception buffer overflow can be solved.
[0350] In some cases, there may be data in the target device 102 that needs to be reported to the server 101 to update the device shadow of the target device 102 in the server 101. Moreover, when there is a large amount of data that the target device 102 needs to report, the target device 102 cannot report all the data at one time. Therefore, the target device 102 can store the data in batches in the data sending buffer, and then report the data stored in the data sending buffer to the server 101. Therefore, when the amount of data that the target device 102 needs to report is greater than the second capacity of the above data sending buffer, when the target device 102 reports the above data in batches, the amount of data reported each time is not greater than the above second capacity.
[0351] Optionally, in a specific implementation, as Figure 5 shown, the information interaction process between the server 101 and the target device 102 in this data transmission system may further include the following steps S501 - S511.
[0352] S501: The target device 102 determines the data to be reported stored in the form of a specified object array.
[0353] In this specific implementation, Figure 5 the information interaction process between the server 101 and the target device 102 in the data transmission system shown is the data reporting process in which the target device 102 reports data to the server 101. In this process, the target device 102 can first determine the data to be reported stored in the form of a specified object array.
[0354] Optionally, in a specific implementation, as Figure 3As shown, the target device 102 can determine the reported attribute value as the data to be reported and send it to the server 101. The server 101 can receive the reported attribute value and store it in the reported area of the device shadow. Among them, the reported area of the device shadow of the target device can store the reported attribute value uploaded by the target device.
[0355] Optionally, in a specific implementation, the target device can determine the data to be reported stored in the form of a specified object array each time it restarts.
[0356] Among them, since among the data to be reported by the target device 102 to the server 101, the data volume of some data may not be greater than the second capacity of the data sending buffer of the target device 102. Therefore, reporting this part of the data to the server 101 usually will not cause data overflow in the data sending buffer, and this part of the data can be directly reported to the server 101. Furthermore, when determining the data to be reported, the local data with a data volume greater than the second capacity can be determined as the data to be reported.
[0357] Based on this, optionally, in a specific implementation, the above step S501 may include the following step 41:
[0358] Step 41: Obtain the local data to be reported and with a data volume greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0359] S502: The target device 102 sends the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported.
[0360] Among them, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported.
[0361] In some cases, the server 101 may already store data identical to the above data to be reported. Therefore, in order not to report repeatedly and save the data storage space of the server 101, after the target device 102 determines the data to be reported, it can further determine the device identifier of the target device 102, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported. And the target device 102 can send the determined device identifier of the target device 102, the specified information of the data to be reported, and the target identifier array composed of the array identifiers of each array in the data to be reported to the server 101.
[0362] The device identifier of the target device 102 uniquely corresponds to the target device 102 . Optionally, the device identifier may be a device serial number.
[0363] S503: The server 101 receives the device identification, the specified information and the target identification array.
[0364] S504: If the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, the server 101 sends a data reporting notification to the target device 102 to prompt the target device 102 to report the data to be reported.
[0365] The server 101 can receive the above-mentioned device identification, specified information and target identification array sent by the target device 102. Then, the server 101 can search for the data information and identification array corresponding to the above-mentioned device identification in the data recorded by itself, and further determine whether the data information corresponding to the recorded device identification is consistent with the specified information, and whether the identification array corresponding to the recorded device identification is consistent with the target identification array.
[0366] Among them, optionally, if the data information corresponding to the recorded device identification is consistent with the specified information, and the identification array corresponding to the recorded device identification is consistent with the target identification array, the server 101 can determine that it has stored the above-mentioned data to be reported, so that the target device 102 does not need to report the above-mentioned data to be reported again. In this way, the server 101 can send a prompt message to the target device 102 to indicate that there is no need to report the data to be reported, so that after receiving the above-mentioned prompt message, the target device 102 can determine that there is no need to report the above-mentioned data to be reported to the server 101, and the data reporting process ends.
[0367] Accordingly, if it is determined that the data information corresponding to the recorded device identification is inconsistent with the specified information, and / or the identification array corresponding to the recorded device identification is inconsistent with the target identification array, that is, if it is determined that any of the following situations exists:
[0368] If the data information corresponding to the recorded device identification is inconsistent with the specified information, the identification array corresponding to the recorded device identification is inconsistent with the target identification array, and the data information corresponding to the recorded device identification is inconsistent with the specified information and the identification array corresponding to the recorded device identification is inconsistent with the target identification array, the server 101 can determine that it does not store the above-mentioned data to be reported, so that the target device 102 can report the above-mentioned data to be reported to the server 101. In this way, the server 101 can send a data reporting notification to the target device 102 for prompting the target device 102 to report the above-mentioned data to be reported, so as to notify the target device 102 to report the data.
[0369] S505: The target device 102 receives a data reporting notification.
[0370] S506: The target device 102 determines, from the data to be reported that has not been reported, a target array whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device.
[0371] S507: The target device 102 reports the target array to the server 101.
[0372] The target device 102 can receive the data reporting notification sent by the server 101. After receiving the data reporting notification, the target device 102 determines, from the data to be reported that has not been reported, a target array whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device 102, and then reports the target array to the server 101.
[0373] S508: The server 101 receives the target array and stores the target array in the device shadow of the target device 102.
[0374] S509: The server 101 sends a first response message to the target device 102.
[0375] The server 101 can receive the target array sent by the target device 102 and store the target array in the device shadow of the target device 102. Furthermore, after receiving the target array sent by the target device 102, the server 101 can send a first response message to the target device 102.
[0376] Optionally, the server 101 can store the target array in the device shadow of the target device 102 and send a first response message to the target device 102; it can also first store the target array in the device shadow of the target device 102 and then send a first response message to the target device 102; or it can first send a first response message to the target device 102 and then store the target array in the device shadow of the target device 102. All of these are reasonable.
[0377] S510: The target device 102 receives the first response message.
[0378] S511: If the target device 102 detects that there is data to be reported that has not been reported, it returns to step S506.
[0379] When the target device 102 receives the first response message sent by the server 101, it can determine that the server 101 has received the target array reported by the target device 102 last time. Furthermore, the target device 102 can then continue to detect whether there is data to be reported that has not been reported.
[0380] If there is no unreported data to be reported, the target device 102 may determine that all the data to be reported have been reported to the server 101 , and the data reporting process is now complete.
[0381] If there is any unreported data to be reported, return to step S506, continue to determine the target array whose sum of the second data amount is not greater than the above-mentioned second capacity in the unreported data to be reported, and report the determined target array to the server 101, and repeat the cycle until it is detected that there is no unreported data to be reported when the first response message sent by the server 101 is received, and thus the data reporting process ends.
[0382] Optionally, in a specific implementation, the target device 102 may also report a first signal representing the first data reporting to the server 101 when reporting the target array for the first time;
[0383] If after determining the target array, it is detected that there is data to be reported that has not been determined as the target array, then when reporting the target array to the server 101, a second signal for characterizing the data reporting is reported to the server 101;
[0384] If after determining the target array, it is detected that there is no data to be reported that has not been determined as the target array, then when reporting the target array to the server 101 , a third signal representing the last data reporting is reported to the server 101 .
[0385] The server 101 may also receive the first signal, the second signal or the third signal sent by the target device.
[0386] Based on this, the server 101 can obtain the data reporting process of the target device 102 each time it receives the target array.
[0387] Based on this, by applying the solution provided by the embodiment of the present application, when the target device needs to report data with a data volume greater than the data transmission buffer capacity of the device to the server, the target device can adopt an incremental reporting method, and the data volume of the target array reported to the server each time is not greater than the first capacity of the data transmission buffer of the target device, and the data to be reported is reported to the server in multiple times to complete the data reporting process. Therefore, the solution provided by the embodiment of the present application can solve the problem of device data transmission buffer overflow caused by the target device reporting data with a data volume greater than the data transmission buffer capacity of the device to the server without increasing the data transmission buffer capacity of the device, that is, without increasing the device cost.
[0388] To facilitate understanding of the process of the target device 102 reporting data to the server 101 in the data transmission system provided by the embodiments of the present application, the following uses a specific example to illustrate the process of the target device 102 reporting data to the server 101.
[0389] As Figure 6 shown, in the data transmission system provided by the embodiments of the present application, the process of the target device 102 reporting data to the server 101 may include the following steps 601 - step 6012.
[0390] Step 601: The device restarts and reads the local status, including the status of the JSON object array.
[0391] After the device restarts, it can report the local status to the shadow service to keep the data in the device shadow synchronized with the data in the device. During the process of reporting the local status to the shadow service, the device can first read the local status to determine the data to be reported, where the above-mentioned data to be reported is stored in the device in the form of a JSON object array.
[0392] Step 602: The device reports basic information to the shadow service, including the serial number, version, and primary key id array.
[0393] After the device determines the data to be reported, it can report the basic information of the device and the data to be reported to the shadow service, including the serial number of the device, the version number of the data to be reported, that is, version, and the primary key id array composed of the id fields of each array in the data to be reported.
[0394] Step 603: The shadow service queries the data of the device corresponding to the device serial number recorded by itself according to the device serial number, and determines whether the version and id array reported by the device are exactly the same as the version and id array of the device recorded. If they are not the same, the device is notified to report the data to be reported.
[0395] Step 604: The shadow service sends a response message to the device, informing the device that it needs to report the data to be reported.
[0396] Step 605: The device incrementally reports the data to be reported to the shadow service, OpType: 0.
[0397] Among them, OpType = 0 indicates that the device is reporting the data to be reported for the first time. The device can determine the data to be reported incrementally each time according to the capacity of its own data sending buffer. That is to say, if the sum of the data volumes of 2 arrays to be reported is less than the capacity of the device's data sending buffer, and the sum of the data volumes of 3 arrays to be reported is greater than the capacity of the device's data sending buffer, the device will send 2 arrays to the shadow service.
[0398] Step 606: The shadow service saves the data incrementally reported by the device.
[0399] Step 607: The shadow service sends a response message, ack.
[0400] After receiving the data incrementally reported by the device, the shadow service sends a response message to the device to notify the device that the data reported by the device has been received.
[0401] Step 608: The device incrementally reports, OpType: 1, indicating reporting in progress.
[0402] After receiving the response message sent by the shadow service, the device continues to incrementally report data to the shadow service.
[0403] Step 609: After the shadow service receives it, it returns a response message, ack.
[0404] After receiving the data incrementally reported by the device, the shadow service sends a response message to the device to notify the device that the data reported by the device has been received.
[0405] Step 6010: Repeat Step 608 and Step 609.
[0406] Step 6011: The device incrementally reports, OpType: 2, indicating the end of reporting, and this is the last request.
[0407] The device continues to report the data to be reported to the shadow service, and the data to be reported carried has the OpType: 2 identifier, which is used to indicate that this data reporting is the last time. After this data reporting is completed, all the data to be reported in the device is reported to the shadow service.
[0408] Step 6012: After the shadow service receives the data to be reported with the OpType: 2 identifier, it sends a response message to the device, ack.
[0409] Thus, the process of the device reporting data to the shadow service ends.
[0410] In some cases, when the operating state of the target device 102 changes itself, it can change its relevant data. Thus, the target device 102 can report the updated data to the server 101 to update the device shadow of the target device 102 in the server 101.
[0411] Optionally, in a specific implementation, as Figure 7 shown, the information interaction process between the server 101 and the target device 102 in this data transmission system may further include the following steps S701 - S705.
[0412] S701: When the target device 102 detects a change in its operating state, it determines the specified data for which there is a data update.
[0413] S702: The target device 102 reports the specified data and a fourth signal used to indicate that data update is being performed to the server 101.
[0414] Among them, the data volume of the specified data is not greater than the second capacity of the data transmission buffer of the target device 102.
[0415] When the target device 102 detects a change in its own operating state, it can determine the specified data for which there is a data update, and then report the above-mentioned specified data and a fourth signal used to indicate that data update is being performed to the server 101.
[0416] Exemplarily, the above-mentioned change in the operating state can be that part of the array in the JSON object array changes. Among them, the operating state data of the target device 102 is stored in the target device 102 in the form of a JSON object array, and the sum of the data volumes of this part of the array is not greater than the second capacity of the data transmission buffer of the target device 102.
[0417] S703: The server 101 receives the specified data and the fourth signal, and uses the specified data to update the data stored in the device shadow of the target device 102.
[0418] S704: The server 101 sends a second response message to the target device 102.
[0419] S705: The target device 102 receives the second response message.
[0420] The server 101 can receive the specified data and the fourth signal reported by the target device 102. Furthermore, when receiving the fourth signal, the server 101 can determine that the received specified data is the data used to update the data stored in the device shadow of the target device 102. Thus, the server 101 can use the specified data to update the data stored in the device shadow of the target device 102, and send a second response message to the target device 102 after the update is completed.
[0421] The target device 102 receives the second response message sent by the server 101. Furthermore, the target device 102 can determine that the server 101 has completed the update of the data stored in the device shadow of the target device 102 using the specified data.
[0422] Based on this, when the operating state of the target device 102 changes, it can report the specified data with updated data to the server 101, thereby realizing data synchronization between the target device 102 and the server 101 during the operation of the target device 102. In addition, since only the specified data with updated data needs to be reported to the server 101 instead of reporting the entire changed operating state in full, data transmission resources can also be saved.
[0423] To facilitate understanding of the process in which the target device 102 reports data to the server 101 when its operating state changes in a data transmission system provided in an embodiment of the present application, the following uses a specific example to illustrate the process in which the target device 102 reports data to the server 101 when its operating state changes.
[0424] As Figure 8 shown, in a data transmission system provided in an embodiment of the present application, the process in which the target device 102 reports data to the server 101 may include the following steps 801-step 804.
[0425] Step 801: During device operation, it is detected that its own state has changed.
[0426] Among them, it may be detected that a part of its own state has changed.
[0427] When the device detects that its own state has changed during operation, it can determine the changed data as the data to be reported.
[0428] Step 802: The device reports the changed part of the state, OpType: 3.
[0429] Since the amount of the to-be-reported data determined above is not greater than the capacity of the device's data reception buffer, when the device reports the changed part of the state, it can carry the OpType: 3 identifier, where the OpType = 3 identifier indicates that the changed part of the state can be reported to the shadow service at one time and does not need to be reported in multiple times.
[0430] Step 803: The shadow service saves the data reported by the device.
[0431] The shadow service can receive and save the changed part of the state reported by the device.
[0432] Step 804: The shadow service sends a response message, ack, to the device.
[0433] After the shadow service saves the changed part of the state reported by the device, it can send a response message ack to the device to inform the device that this data reporting is over.
[0434] AsFigure 9 As shown in Figure 9 , an embodiment of the present application further provides a data transmission method, which is applied to a server in a data transmission system. The data transmission system further includes a target device, and the server is provided with a device shadow of the target device. The method includes the following steps S901 - S904:
[0435] S901: Determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending - down notice to the target device for prompting the target device to send an incremental sending - down request, so that after receiving the data sending - down notice, the target device sends an incremental sending - down request to the server.
[0436] Among them, the incremental sending - down request includes the first capacity of the data receiving buffer of the target device.
[0437] S902: Receive the incremental sending - down request, and determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending - down request.
[0438] S903: If there is no data to be sent down that has not been determined as the specified array, send the specified array carrying a specified identifier to the target device, so that the target device receives the specified array, processes the data of the specified array, and when detecting that the specified array carries the specified identifier, sends a sending - down termination signal to the server indicating that all the data to be sent down has been received; if there is data to be sent down that has not been determined as the specified array, send the specified array to the target device, so that the target device receives the specified array, processes the data of the specified array, and when detecting that the specified array does not carry the specified identifier, sends a new incremental sending - down request to the server.
[0439] Among them, the specified identifier is used to indicate that after sending down the specified array, there is no data to be sent down that has not been sent down on the server.
[0440] S904: Receive the sending - down termination signal; or, receive a new incremental sending - down request, and return to the step of determining a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending - down request.
[0441] Based on this, when applying the solution provided in the embodiments of the present application, when the amount of data to be sent by the server to the target device is greater than the first capacity of the data reception buffer of the target device, the server can adopt an incremental sending method to send the data to be sent to the target device in batches in the form of a specified object array, and moreover, the amount of data of each specified array sent to the target device each time is not greater than the above-mentioned first capacity. In this way, since the data is sent in the form of a specified object array each time, the target device can immediately process the data in the specified array after receiving the specified array, so as to avoid occupying the space of the data reception buffer. Furthermore, it is convenient to receive the next specified array sent by the server. Therefore, the solution provided in the embodiments of the present application can solve the problem of data reception buffer overflow of the device caused by the server sending data with an amount greater than the capacity of the data reception buffer of the device without increasing the device cost.
[0442] In addition, since the target device can immediately process the specified array each time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be sent, and then process the integrated array. Therefore, there is no need to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be sent can be effectively improved.
[0443] Optionally, in a specific implementation manner, the method further includes:
[0444] Before sending the data sending notification for prompting the target device to send an incremental sending request to the target device, extract the array identifier of each array in the data to be sent, and construct an identifier list based on the extracted array identifiers;
[0445] The determining, according to the incremental sending request, a specified array in the data to be sent that has not been sent and the sum of the first data amounts of which is not greater than the first capacity includes:
[0446] Traverse each array in the data to be sent that has not been sent in sequence starting from the first array in the data to be sent that has not been sent according to the array arrangement order represented by the identifier list;
[0447] When traversing each array, calculate the sum of the first data amounts of the traversed array;
[0448] When the sum of the first data amounts is not greater than the first capacity, traverse the next array;
[0449] When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine the other arrays except the last array among the traversed arrays as the specified array.
[0450] Optionally, in a specific implementation, the incremental distribution request further includes: the specified array identifier of the last received array;
[0451] Traversing each array in the to-be-distributed data that has not been distributed in sequence starting from the first array in the to-be-distributed data that has not been distributed according to the array arrangement order represented by the identifier list includes:
[0452] Traversing each array in the to-be-distributed data in sequence starting from the array to which the next array identifier after the specified array identifier belongs according to the array arrangement order represented by the identifier list.
[0453] Optionally, in a specific implementation, the incremental distribution request further includes: a specified quantity;
[0454] Determining the specified arrays in the to-be-distributed data that has not been distributed whose sum of the first data amounts is not greater than the first capacity according to the incremental distribution request includes:
[0455] Traversing each array in the to-be-distributed data that has not been distributed; when traversing to an array each time, determining the sum of the first data amounts of the traversed array and the quantity of the traversed array;
[0456] If the sum of the first data amounts is not greater than the first capacity and the quantity is less than the specified quantity, then traverse the next array;
[0457] If the sum of the first data amounts is not greater than the first capacity and the quantity is equal to the specified quantity, then stop traversing and determine the traversed arrays as the specified arrays;
[0458] If the sum of the first data amounts is greater than the first capacity and the quantity is not greater than the specified quantity, then stop traversing and determine, among the traversed arrays, the arrays other than the last array as the specified arrays.
[0459] Optionally, in a specific implementation, the method further includes:
[0460] Deleting the stored specified arrays.
[0461] Optionally, in a specific implementation, the incremental distribution request further includes: the target number of times for the target device to receive the specified arrays;
[0462] The deleting the stored specified arrays includes:
[0463] Read the target number in the incremental distribution request, and calculate the difference between the target number and 1; if the specified number of times to delete the specified array currently recorded by the server is equal to the difference, then delete the most recently determined specified array before receiving this incremental distribution request, and update the specified number to the sum of the currently recorded specified number and 1; wherein, the initial value of the specified number is 0;
[0464] After receiving the distribution termination signal, delete the last determined specified array.
[0465] Optionally, in a specific implementation manner, the determination of the data to be distributed stored in the device shadow in the form of a specified object array includes;
[0466] Receive the expected attribute value of the target device sent by the user through the user terminal, and store the expected attribute value in the device shadow in the form of a specified object array as the data to be distributed.
[0467] Optionally, in a specific implementation manner, the method further includes:
[0468] Receive the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported sent by the target device after determining the data to be reported stored in the form of the specified object array; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0469] If the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or, the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, then send a data reporting notification for prompting the target device to report the data to be reported to the target device, so that after receiving the data reporting notification, the target device determines a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reports the target array to the server;
[0470] Receive the target array, store the target array in the device shadow of the target device and send a first response message to the server, so that the target device receives the first response message;
[0471] Receive the target array determined by the target device in the unreported data to be reported when detecting that there is unreported data to be reported, and return to the step of receiving the target array.
[0472] Optionally, in a specific implementation, the determination of the data to be reported stored in the form of the specified object array includes:
[0473] Obtain local data to be reported and with a data volume greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0474] Optionally, in a specific implementation,
[0475] Receive the first signal, the second signal or the third signal sent by the target device;
[0476] Among them, the first signal is: when the target device reports the target array for the first time, the signal reported to the server for characterizing the first data reporting; the second signal is: when the target device determines the target array and detects that there is data to be reported that has not been determined as the target array, when reporting the target array to the server, the signal reported to the server for characterizing the signal in the data reporting; the third signal is: when the target device determines the target array and detects that there is no data to be reported that has not been determined as the target array, when reporting the target array to the server, the signal reported to the server for characterizing the last data reporting.
[0477] Optionally, in a specific implementation,
[0478] Receive the specified data sent by the target device and the fourth signal for characterizing data update; wherein, the specified data is the specified data with data update determined by the target device when detecting a change in the operating state, and the data volume of the specified data is not greater than the second capacity of the data sending buffer of the target device;
[0479] Use the specified data to update the data stored in the device shadow of the target device, and send a second response message to the target device so that the target device receives the second response message.
[0480] As Figure 10 shown, an embodiment of the present application further provides a data transmission method, which is applied to a target device in a data transmission system. The data transmission system further includes a server, and the server is provided with a device shadow of the target device; the method includes the following steps S1001 - S1003:
[0481] Step S1001: Receive a data download notification.
[0482] Among them, the data distribution notice is a notice sent by the server to the target device after determining the data to be distributed stored in the device shadow in the form of a specified object array, for prompting the target device to send an incremental distribution request.
[0483] Step S1002: Send an incremental distribution request to the server, so that after receiving the incremental distribution request, the server determines a specified array whose sum of the first data amounts in the undistributed data to be distributed is not greater than the first capacity according to the incremental distribution request, and if there is no data to be distributed that has not been determined as the specified array, the server distributes the specified array carrying the specified identifier to the target device; otherwise, the server distributes the specified array to the target device.
[0484] Among them, the incremental distribution request includes the first capacity of the data reception buffer of the target device, and the specified identifier is used to indicate that after the specified array is distributed, the server has no undistributed data to be distributed.
[0485] Step S1003: Receive the specified array and perform data processing on the specified array; if it is detected that the specified array carries the specified identifier, send a distribution termination signal indicating that all the data to be distributed has been received to the server, so that the server receives the distribution termination signal; otherwise, return to the step of sending the incremental distribution request to the server.
[0486] Based on this, by applying the solution provided in the embodiments of the present application, when the amount of data to be distributed from the server to the target device is greater than the first capacity of the data reception buffer of the target device, the server can adopt an incremental distribution method to batch-distribute the data to be distributed to the target device in the form of a specified object array, and moreover, the data amount of each specified array distributed to the target device is not greater than the above-mentioned first capacity. In this way, since each time the data is distributed in the form of a specified object array, the target device can immediately perform data processing on the specified array after receiving the specified array, so as to avoid occupying the space of the data reception buffer, and further facilitate receiving the next specified array sent by the server. Therefore, the solution provided in the embodiments of the present application can solve the problem of data reception buffer overflow of the device caused by the server distributing data with an amount greater than the capacity of the device's data reception buffer without increasing the device cost.
[0487] In addition, since the target device can immediately perform data processing on the specified array each time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be distributed and then perform data processing on the integrated array. Thus, there is no need to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be distributed can be effectively improved.
[0488] Optionally, in a specific implementation, the data to be sent includes: the expected attribute value of the target device sent by the user through the user terminal;
[0489] The data processing on the specified array includes:
[0490] Performing attribute setting according to the specified array.
[0491] Optionally, in a specific implementation, the method further includes:
[0492] Determining the data to be reported stored in the form of the specified object array, and sending the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of the array identifiers of each array in the data to be reported to the server, so that after receiving the device identifier, the specified information, and the target identifier array, if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, the server sends a data reporting notification for prompting the target device to report the data to be reported to the target device; wherein, the specified information includes: the type of the data to be reported, and / or the version number of the data to be reported;
[0493] Receiving the data reporting notification; determining a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reporting the target array to the server, so that after receiving the target array, the server stores the target array in the device shadow of the target device and sends a first response message to the server;
[0494] Receiving the first response message; if it is detected that there is unreported data to be reported, returning to the step of determining a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device.
[0495] Optionally, in a specific implementation, the determining the data to be reported stored in the form of the specified object array includes:
[0496] Obtaining local data to be reported and with a data amount greater than the second capacity, and converting the local data into data stored in the form of a specified object array as the data to be reported.
[0497] Optionally, in a specific implementation, the method further includes:
[0498] When reporting the target array for the first time, report to the server a first signal for characterizing the first data reporting.
[0499] If after determining the target array, it is detected that there is the data to be reported that has not been determined as the target array, then when reporting the target array to the server, report to the server a second signal for characterizing the data reporting.
[0500] If after determining the target array, it is detected that there is no data to be reported that has not been determined as the target array, then when reporting the target array to the server, report to the server a third signal for characterizing the last data reporting.
[0501] Optionally, in a specific implementation manner, the method further includes:
[0502] When detecting a change in the running state, determine the specified data with data update; wherein, the data volume of the specified data is not greater than the second capacity of the data sending buffer of the target device.
[0503] Report the specified data and a fourth signal for characterizing the data update to the server, so that after receiving the specified data and the fourth signal, the server uses the specified data to perform data update on the data stored in the device shadow of the target device, and sends a second response message to the target device.
[0504] Receive the second response message.
[0505] As Figure 11 shown, an embodiment of the present application further provides a data transmission device, which is applied to a server in a data transmission system. The data transmission system further includes a target device, and the server is provided with a device shadow of the target device. Figure 11 For a structural schematic diagram of a data transmission device provided by an embodiment of the present application, as Figure 11 shown, the data transmission device may include the following modules:
[0506] Data determination module 1101: used to determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending-down notice to the target device for prompting the target device to send an incremental sending-down request, so that after receiving the data sending-down notice, the target device sends the incremental sending-down request to the server; wherein, the incremental sending-down request includes the first capacity of the data receiving buffer of the target device.
[0507] A request receiving module 1102, configured to receive the incremental distribution request, and determine, according to the incremental distribution request, a specified array in the to-be-distributed data that has not been distributed, where the sum of the first data amounts is not greater than the first capacity;
[0508] An array distribution module 1103, configured to, when there is no to-be-distributed data that has not been determined as the specified array, distribute the specified array carrying a specified identifier to the target device, so that the target device receives the specified array, processes the data in the specified array, and when detecting that the specified array carries the specified identifier, send a distribution termination signal for indicating that all the to-be-distributed data has been received to the server; where the specified identifier is used to indicate that after the specified array is distributed, there is no to-be-distributed data that has not been distributed on the server; when there is to-be-distributed data that has not been determined as the specified array, distribute the specified array to the target device, so that the target device receives the specified array, processes the data in the specified array, and when detecting that the specified array does not carry the specified identifier, send a new incremental distribution request to the server;
[0509] A signal receiving module 1104, configured to receive the distribution termination signal; or receive the new incremental distribution request, and return to the step of determining, according to the incremental distribution request, a specified array in the to-be-distributed data that has not been distributed, where the sum of the first data amounts is not greater than the first capacity.
[0510] Based on this, by applying the solution provided in the embodiments of the present application, when the amount of to-be-distributed data that the server needs to distribute to the target device is greater than the first capacity of the data reception buffer of the target device, the server can adopt an incremental distribution method to batch-distribute the to-be-distributed data to the target device in the form of a specified object array, and moreover, the amount of data in each specified array distributed to the target device is not greater than the above-mentioned first capacity. In this way, since each time the data is distributed in the form of a specified object array, the target device can immediately process the data in the specified array after receiving the specified array, so as to avoid occupying the space of the data reception buffer, and further, facilitate receiving the specified array sent by the server next time. Therefore, the solution provided in the embodiments of the present application can solve the problem of data reception buffer overflow of the device caused by the server distributing data with an amount greater than the capacity of the data reception buffer of the device without increasing the device cost.
[0511] In addition, since the target device can immediately process the data of the specified array every time it receives the specified array sent by the server, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be sent, and then process the data of the integrated array. Therefore, it is not necessary to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be sent can be effectively improved.
[0512] Optionally, in a specific implementation manner, the device further includes:
[0513] An identification extraction module, configured to extract the array identification of each array in the data to be sent before sending the data sending notification for prompting the target device to send an incremental sending request to the target device, and construct an identification list based on the extracted array identifications;
[0514] The request receiving module is specifically configured to:
[0515] Traverse each array in the data to be sent that has not been sent in sequence, starting from the first array in the data to be sent that has not been sent, according to the array arrangement order represented by the identification list;
[0516] When traversing each array, calculate the sum of the first data amounts of the traversed array;
[0517] When the sum of the first data amounts is not greater than the first capacity, traverse the next array;
[0518] When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine all the arrays traversed except the last array as the specified array.
[0519] Optionally, in a specific implementation manner, the incremental sending request further includes: the specified array identification of the last received array;
[0520] The request receiving module is specifically configured to:
[0521] Traverse each array in the data to be sent in sequence, starting from the array to which the next array identification of the specified array identification belongs, according to the array arrangement order represented by the identification list.
[0522] Optionally, in a specific implementation manner, the incremental sending request further includes: a specified quantity;
[0523] The request receiving module is specifically configured to:
[0524] Traverse each array in the to-be-issued data that has not been issued; when traversing each array, determine the sum of the first data volumes of the traversed array and the number of the traversed array;
[0525] If the sum of the first data volumes is not greater than the first capacity and the number is less than the specified number, traverse the next array;
[0526] If the sum of the first data volumes is not greater than the first capacity and the number is equal to the specified number, stop traversing and determine the traversed arrays as the specified arrays;
[0527] If the sum of the first data volumes is greater than the first capacity and the number is not greater than the specified number, stop traversing and determine, among the traversed arrays, the arrays other than the last array as the specified arrays.
[0528] Optionally, in a specific implementation manner, the device further includes:
[0529] Array deletion module: used to delete the stored specified arrays.
[0530] Optionally, in a specific implementation manner, the incremental issuance request further includes: the target number of times for the target device to receive the specified array;
[0531] The array deletion module is specifically used for:
[0532] Read the target number of times in the incremental issuance request and calculate the difference between the target number of times and 1; if the specified number of times for the server to currently record deleting the specified array is equal to the difference, delete the specified array determined most recently before receiving this incremental issuance request, and update the specified number of times to the sum of the currently recorded specified number of times and 1; where the initial value of the specified number of times is 0;
[0533] After receiving the issuance termination signal, delete the specified array determined last time.
[0534] Optionally, in a specific implementation manner, the data determination module is specifically used for:
[0535] Receive the expected attribute value about the target device sent by the user through the user terminal, and store the expected attribute value in the device shadow in the form of a specified object array as the to-be-issued data.
[0536] Optionally, in a specific implementation manner, the device further includes:
[0537] Identification receiving module: It is used to receive the device identification of the target device, the specified information of the data to be reported, and a target identification array composed of the array identifiers of each array in the data to be reported, which are sent by the target device after determining the data to be reported stored in the form of the specified object array; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0538] Notification reporting module: It is used to send a data reporting notification for prompting the target device to report the data to be reported to the target device when the data information corresponding to the recorded device identification is inconsistent with the specified information, and / or, the identification array corresponding to the recorded device identification is inconsistent with the target identification array, so that after receiving the data reporting notification, the target device determines a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and reports the target array to the server;
[0539] Target array receiving module: It is used to receive the target array, store the target array in the device shadow of the target device and send a first response message to the server, so that the target device receives the first response message;
[0540] Target array determination module: It is used to receive the target device to determine a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device when detecting that there is unreported data to be reported, and return to the step of receiving the target array.
[0541] Optionally, in a specific implementation manner, the determination of the data to be reported stored in the form of the specified object array includes:
[0542] Obtain local data to be reported and with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0543] Optionally, in a specific implementation manner, the device further includes:
[0544] Second signal receiving module: It is used to receive the first signal, the second signal or the third signal sent by the target device;
[0545] Among them, the first signal is: when the target device reports the target array for the first time, it reports to the server a signal for characterizing the first data reporting; the second signal is: after the target device determines the target array, when it detects that there is data to be reported that has not been determined as the target array, when reporting the target array to the server, it reports to the server a signal for characterizing the data reporting; the third signal is: after the target device determines the target array, when it detects that there is no data to be reported that has not been determined as the target array, when reporting the target array to the server, it reports to the server a signal for characterizing the last data reporting.
[0546] Optionally, in a specific implementation, the device further includes:
[0547] A data receiving module: configured to receive the specified data sent by the target device and a fourth signal for characterizing data update; wherein, the specified data is the specified data with data update determined by the target device when detecting a change in the operating state, and the data volume of the specified data is not greater than the second capacity of the data sending buffer of the target device.
[0548] A data update module, configured to update the data stored in the device shadow of the target device with the specified data, and send a second response message to the target device, so that the target device receives the second response message.
[0549] As Figure 12 shown, an embodiment of the present application further provides a data transmission device, which is applied to a target device in a data transmission system. The data transmission system further includes a server, and the server is provided with a device shadow of the target device. Figure 12 As a schematic structural diagram of a data transmission device provided by an embodiment of the present application, as Figure 12 shown, the data transmission device may include the following modules:
[0550] A notification receiving module 1201: configured to receive a data download notification.
[0551] Among them, the data download notification is a notification sent by the server to the target device after determining the data to be downloaded stored in the device shadow in the form of a specified object array, for prompting the target device to send an incremental download request.
[0552] A request sending module 1202, configured to send an incremental delivery request to a server, so that after receiving the incremental delivery request, the server determines a specified array in the undelivered data to be delivered, where the sum of the first data amounts is not greater than a first capacity, and if there is no undelivered data that has not been determined as the specified array, the server sends the specified array carrying a specified identifier to a target device; otherwise, the server sends the specified array to the target device.
[0553] Wherein, the incremental delivery request includes the first capacity of a data reception buffer of the target device, and the specified identifier is used to indicate that after the specified array is delivered, there is no undelivered data to be delivered on the server.
[0554] An array reception module 1203: configured to receive the specified array and perform data processing on the specified array; if it is detected that the specified array carries the specified identifier, it sends a delivery termination signal indicating that all data to be delivered has been received to the server, so that the server receives the delivery termination signal; otherwise, it returns to the step of sending the incremental delivery request to the server.
[0555] Based on this, by applying the solution provided in the embodiment of the present application, when the amount of data to be delivered from the server to the target device is greater than the first capacity of the data reception buffer of the target device, the server can adopt an incremental delivery method to deliver the data to be delivered to the target device in batches in the form of a specified object array, and moreover, the amount of data of each specified array delivered to the target device is not greater than the above-mentioned first capacity. In this way, since each time the data is delivered in the form of a specified object array, the target device can immediately perform data processing on the specified array after receiving the specified array, so as to avoid occupying the space of the data reception buffer, and further facilitate receiving the next specified array sent by the server. Therefore, the solution provided in the embodiment of the present application can solve the problem of data reception buffer overflow of the device caused by the server delivering data with an amount greater than the capacity of the device's data reception buffer without increasing the device cost.
[0556] In addition, since the target device can immediately perform data processing on the specified array sent by the server each time it receives the specified array, the target device does not need to integrate the specified arrays received in batches after receiving all the data to be delivered, and then perform data processing on the integrated array. Therefore, there is no need to increase the data processing workload of the target device, and the processing efficiency of the target device for the data to be delivered can be effectively improved.
[0557] Optionally, in a specific implementation manner, the data to be delivered includes: expected attribute values of the target device sent by a user through a user terminal;
[0558] The data reception module is specifically configured to:
[0559] Perform attribute setting according to the specified array.
[0560] Optionally, in a specific implementation, the device further includes:
[0561] A data-to-be-reported determination module, configured to determine data to be reported stored in the form of the specified object array, and send the device identifier of the target device, the specified information of the data to be reported, and a target identifier array composed of array identifiers of each array in the data to be reported to the server, so that after receiving the device identifier, the specified information, and the target identifier array, if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or, the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, the server sends a data reporting notification for prompting the target device to report the data to be reported to the target device; wherein, the specified information includes: the type of the data to be reported, and / or, the version number of the data to be reported;
[0562] An array reporting module, configured to receive the data reporting notification; determine a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data transmission buffer of the target device, and report the target array to the server, so that after receiving the target array, the server stores the target array in the device shadow of the target device and sends a first response message to the server;
[0563] A message receiving module, configured to receive the first response message; if it is detected that there is unreported data to be reported, return to the step of determining a target array in the unreported data to be reported whose sum of the second data amounts is not greater than the second capacity of the data transmission buffer of the target device.
[0564] Optionally, in a specific implementation, the data-to-be-reported determination module is specifically configured to:
[0565] Obtain local data to be reported and with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
[0566] Optionally, in a specific implementation, the device further includes:
[0567] A signal reporting module, configured to report to the server a first signal for characterizing the first data reporting when reporting the target array for the first time; if it is determined that there is pending data that has not been determined as the target array after determining the target array, then when reporting the target array to the server, report to the server a second signal for characterizing data reporting; if it is determined that there is no pending data that has not been determined as the target array after determining the target array, then when reporting the target array to the server, report to the server a third signal for characterizing the last data reporting.
[0568] Optionally, in a specific implementation manner, the device further includes:
[0569] A specified data determination module, configured to determine specified data with data updates when detecting a change in the running state; wherein, the amount of the specified data is not greater than a second capacity of a data sending buffer of the target device;
[0570] A fourth signal reporting module, configured to report the specified data and a fourth signal for characterizing data updates to the server, so that after receiving the specified data and the fourth signal, the server uses the specified data to update the data stored in the device shadow of the target device, and sends a second response message to the target device;
[0571] A response message receiving module, configured to receive the second response message.
[0572] An embodiment of the present application further provides a server, as Figure 13 shown, including:
[0573] A memory 1301, configured to store a computer program;
[0574] A processor 1302, configured to implement any method steps of data transmission applied to the server provided by the embodiment of the present application when executing the program stored on the memory 1301.
[0575] And the above server may further include a communication bus and / or a communication interface, and the processor 1302, the communication interface, and the memory 1301 complete communication with each other through the communication bus.
[0576] An embodiment of the present application further provides an electronic device, as Figure 14 shown, including:
[0577] A memory 1401, configured to store a computer program;
[0578] The processor 1402, when executing the program stored in the memory 1401, implements the method steps of any data transmission applied to the target device provided in the embodiments of the present application.
[0579] Moreover, the above-mentioned server and target device may further include a communication bus and / or a communication interface. The processor 1402, the communication interface, and the memory 1401 complete mutual communication through the communication bus.
[0580] The communication bus mentioned in the above-mentioned electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience in representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0581] The communication interface is used for communication between the above-mentioned electronic device and other devices.
[0582] The memory may include a Random Access Memory (RAM), and may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0583] The above-mentioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0584] In another embodiment provided by the present application, a computer-readable storage medium is further provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned any data transmission method are implemented.
[0585] In yet another embodiment provided by the present application, a computer program product including instructions is further provided. When it runs on a computer, it causes the computer to execute any of the data transmission methods in the above embodiments.
[0586] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0587] It should be noted that in this article, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device including the element.
[0588] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, device embodiment, server embodiment, target device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment.
[0589] The foregoing are only the preferred embodiments of the present application and are not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application are all included in the protection scope of the present application.
Claims
1. A data transmission system, characterized in that, The system includes: a target device and a server; the server is provided with a device shadow of the target device; The server is configured to determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending-down notice to the target device for prompting the target device to send an incremental sending-down request; The target device is configured to receive the data sending-down notice and send the incremental sending-down request to the server; wherein, the incremental sending-down request includes a first capacity of a data receiving buffer of the target device; The server is further configured to receive the incremental sending-down request; according to the incremental sending-down request, determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts of the specified array is not greater than the first capacity; if there is no data to be sent down that has not been determined as the specified array, send the specified array carrying a specified identifier to the target device; otherwise, send the specified array to the target device; wherein, the specified identifier is used to indicate that after the specified array is sent down, there is no data to be sent down that has not been sent down by the server; The target device is further configured to receive the specified array and perform data processing on the specified array; if it is detected that the specified array carries the specified identifier, send a sending-down termination signal to the server for indicating that all the data to be sent down has been received, otherwise, return to the step of sending the incremental sending-down request to the server; The server is further configured to receive the sending-down termination signal.
2. The system according to claim 1, wherein, The server is further configured to, before sending the data sending-down notice to the target device for prompting the target device to send an incremental sending-down request, extract the array identifier of each array in the data to be sent down, and construct an identifier list based on the extracted array identifiers; The server determines a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity, according to the incremental sending-down request, including: Traverse each array in the data to be sent down that has not been sent down in turn, starting from the first array in the data to be sent down that has not been sent down, according to the array arrangement order represented by the identifier list; When traversing each array, calculate the sum of the first data amounts of the traversed array; When the sum of the first data amounts is not greater than the first capacity, traverse the next array; When the sum of the first data amounts is greater than the first capacity, stop traversing, and determine the arrays among the traversed arrays, except the last array, as the specified array.
3. The system according to claim 2, wherein The incremental sending-down request further includes: a specified array identifier of the last received array; The traversing each array in the data to be sent down that has not been sent down in turn, starting from the first array in the data to be sent down that has not been sent down, according to the array arrangement order represented by the identifier list, includes: Traverse each array in the data to be sent down in turn, starting from the array to which the next array identifier after the specified array identifier belongs, according to the array arrangement order represented by the identifier list.
4. The system according to claim 1, characterized in that, The incremental distribution request further includes: a specified quantity; Determining, according to the incremental distribution request, a specified array in the to-be-distributed data that has not been distributed, where the sum of the first data volumes is not greater than the first capacity, includes: Traversing each array in the to-be-distributed data that has not been distributed; when traversing each array, determining the sum of the first data volumes of the traversed array and the number of the traversed array; If the sum of the first data volumes is not greater than the first capacity and the number is less than the specified quantity, traverse the next array; If the sum of the first data volumes is not greater than the first capacity and the number is equal to the specified quantity, stop traversing and determine the traversed arrays as the specified array; If the sum of the first data volumes is greater than the first capacity and the number is not greater than the specified quantity, stop traversing and determine, among the traversed arrays, the arrays other than the last array as the specified array.
5. The system according to claim 1, wherein The server is further configured to delete the stored specified array.
6. The system according to claim 5, wherein The incremental distribution request further includes: the target number of times for the target device to receive the specified array; The server deleting the stored specified array includes: Reading the target number of times in the incremental distribution request and calculating the difference between the target number of times and 1; if the specified number of times for the server to currently record deleting the specified array is equal to the difference, deleting the specified array determined most recently before receiving this incremental distribution request, and updating the specified number of times to the sum of the currently recorded specified number of times and 1; wherein, the initial value of the specified number of times is 0; After receiving the distribution termination signal, deleting the specified array determined last time.
7. The system according to claim 1, wherein The server determining the to-be-distributed data stored in the device shadow in the form of a specified object array includes; Receiving the expected attribute value of the target device sent by the user through the user terminal and storing the expected attribute value in the device shadow in the form of a specified object array as the to-be-distributed data; The target device performing data processing on the specified array includes: The target device performing attribute setting according to the specified array.
8. The system according to claim 1, wherein The target device is further configured to determine the to-be-reported data stored in the form of the specified object array, and send the device identifier of the target device, the specified information of the to-be-reported data, and a target identifier array composed of the array identifiers of each array in the to-be-reported data to the server; wherein, the specified information includes: the type of the to-be-reported data, and / or, the version number of the to-be-reported data; The server is further configured to receive the device identifier, the specified information, and the target identifier array; if the data information corresponding to the recorded device identifier is inconsistent with the specified information, and / or the identifier array corresponding to the recorded device identifier is inconsistent with the target identifier array, then send a data reporting notification for prompting the target device to report the data to be reported to the target device; The target device is further configured to receive the data reporting notification; determine a target array in the data to be reported that has not been reported, where the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device, and report the target array to the server; The server is further configured to receive the target array, store the target array in the device shadow of the target device, and send a first response message to the server; The target device is further configured to receive the first response message; if it is detected that there is data to be reported that has not been reported, then return to the step of determining a target array in the data to be reported that has not been reported, where the sum of the second data amounts is not greater than the second capacity of the data sending buffer of the target device.
9. The system according to claim 8, wherein, The determination of the data to be reported stored in the form of the specified object array includes: Obtain local data to be reported with a data amount greater than the second capacity, and convert the local data into data stored in the form of a specified object array as the data to be reported.
10. The system according to claim 8, wherein The target device is further configured to, when reporting the target array for the first time, report a first signal to the server for indicating that data reporting is performed for the first time; If after determining the target array, it is detected that there is data to be reported that has not been determined as the target array, then when reporting the target array to the server, report a second signal to the server for indicating data reporting; If after determining the target array, it is detected that there is no data to be reported that has not been determined as the target array, then when reporting the target array to the server, report a third signal to the server for indicating that it is the last time to perform data reporting; The server is further configured to receive the first signal, the second signal, or the third signal.
11. The system according to any one of claims 1-10, wherein The target device is further configured to, when detecting a change in the operating state, determine specified data with data updates; and report the specified data and a fourth signal for indicating data update to the server; wherein the data amount of the specified data is not greater than the second capacity of the data sending buffer of the target device; The server is further configured to receive the specified data and the fourth signal; use the specified data to update the data stored in the device shadow of the target device, and send a second response message to the target device; The target device is further configured to receive the second response message.
12. A data transmission method, characterized in that, A server applied to a data transmission system, the data transmission system further including a target device, the server being provided with a device shadow of the target device; the method includes: Determine the data to be sent down stored in the device shadow in the form of a specified object array, and send a data sending-down notice to the target device for prompting the target device to send an incremental sending-down request, so that after receiving the data sending-down notice, the target device sends the incremental sending-down request to the server; wherein, the incremental sending-down request includes a first capacity of a data receiving buffer of the target device; Receive the incremental sending-down request, and determine a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending-down request; If there is no data to be sent down that has not been determined as the specified array, send down the specified array carrying a specified identifier to the target device, so that the target device receives the specified array, performs data processing on the specified array, and when detecting that the specified array carries the specified identifier, sends a sending-down termination signal to the server for representing that all the data to be sent down has been received; wherein, the specified identifier is used for representing that after sending down the specified array, there is no data to be sent down that has not been sent down by the server; If there is data to be sent down that has not been determined as the specified array, send down the specified array to the target device, so that the target device receives the specified array, performs data processing on the specified array, and when detecting that the specified array does not carry the specified identifier, sends a new incremental sending-down request to the server; Receive the sending-down termination signal; Or, Receive the new incremental sending-down request, and return to the step of determining a specified array in the data to be sent down that has not been sent down, where the sum of the first data amounts is not greater than the first capacity according to the incremental sending-down request.
13. A data transmission method, characterized in that, A target device applied to a data transmission system, the data transmission system further including a server, the server being provided with a device shadow of the target device; the method includes: Receive a data sending-down notice; wherein, the data sending-down notice is a notice sent by the server to the target device for prompting the target device to send an incremental sending-down request after determining the data to be sent down stored in the device shadow in the form of a specified object array. Send the incremental download request to the server; wherein, the incremental download request includes the first capacity of the data reception buffer of the target device, so that after receiving the incremental download request, the server determines, according to the incremental download request, a specified array in the undownloaded data to be downloaded, the sum of the first data amounts of which is not greater than the first capacity, and if there is no data to be downloaded that has not been determined as the specified array, the server downloads the specified array carrying a specified identifier to the target device; otherwise, the server downloads the specified array to the target device; wherein, the specified identifier is used to indicate that after the specified array is downloaded, there is no undownloaded data to be downloaded on the server. Receive the specified array and perform data processing on the specified array. If it is detected that the specified array carries the specified identifier, send a download termination signal indicating that all the data to be downloaded has been received to the server, so that the server receives the download termination signal. Otherwise, return to the step of sending the incremental download request to the server.
14. A data transmission device, characterized in that, Applied to a server in a data transmission system, the data transmission system further includes a target device, and the server is provided with a device shadow of the target device; the device includes: A data determination module: used to determine the data to be downloaded stored in the device shadow in the form of a specified object array, and send a data download notification to the target device to prompt the target device to send an incremental download request, so that after receiving the data download notification, the target device sends the incremental download request to the server; wherein, the incremental download request includes the first capacity of the data reception buffer of the target device. A request reception module, used to receive the incremental download request and determine, according to the incremental download request, a specified array in the undownloaded data to be downloaded, the sum of the first data amounts of which is not greater than the first capacity. An array download module: used to download the specified array carrying a specified identifier to the target device when there is no data to be downloaded that has not been determined as the specified array, so that the target device receives the specified array, performs data processing on the specified array, and when it is detected that the specified array carries the specified identifier, sends a download termination signal indicating that all the data to be downloaded has been received to the server; wherein, the specified identifier is used to indicate that after the specified array is downloaded, there is no undownloaded data to be downloaded on the server; when there is data to be downloaded that has not been determined as the specified array, download the specified array to the target device, so that the target device receives the specified array, performs data processing on the specified array, and when it is detected that the specified array does not carry the specified identifier, send a new incremental download request to the server. A signal receiving module, configured to receive the issued termination signal; or, receive the new incremental issuing request, and return the step of determining, according to the incremental issuing request, a specified array in the to-be-issued data that has not been issued and the sum of the first data amounts is not greater than the first capacity.
15. A data transmission device, characterized in that, Applied to a target device in a data transmission system, the data transmission system further includes a server, and the server is provided with a device shadow of the target device; the apparatus includes: A notification receiving module, configured to receive a data issuing notification; wherein, the data issuing notification is a notification sent by the server to the target device after determining the to-be-issued data stored in the device shadow in the form of a specified object array, for prompting the target device to send an incremental issuing request. A request sending module, configured to send the incremental issuing request to the server; wherein, the incremental issuing request includes a first capacity of a data receiving buffer of the target device, so that after receiving the incremental issuing request, the server determines, according to the incremental issuing request, a specified array in the to-be-issued data that has not been issued and the sum of the first data amounts is not greater than the first capacity, and if there is no to-be-issued data that has not been determined as the specified array, the server issues the specified array carrying a specified identifier to the target device; otherwise, the server issues the specified array to the target device; wherein, the specified identifier is used to indicate that after issuing the specified array, the server has no to-be-issued data that has not been issued. A data receiving module: configured to receive the specified array and perform data processing on the specified array; when detecting that the specified array carries the specified identifier, send a termination signal for issuing to the server to indicate that all the to-be-issued data has been received, so that the server receives the termination signal for issuing; when detecting that the specified array does not carry the specified identifier, return the step of sending the incremental issuing request to the server.
16. A server, characterized in that, Comprising: A memory, configured to store a computer program. A processor, when executing the program stored on the memory, implements the method according to claim 12.
17. An electronic device, characterized in that, Comprising: A memory, configured to store a computer program. A processor, when executing the program stored on the memory, implements the method according to claim 13.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the method according to claim 12 or 13.
Citation Information
Patent Citations
Configuration information issuing method and device, storage medium and processor
CN113312075A
Data processing method, device and system, electronic equipment and storage medium
CN113381984A