Disclosure of Invention
In view of the above problems, the present invention provides a method and an apparatus for automatically adjusting an internet of things upload parameter, a terminal device, and a readable storage medium, so as to ensure that the terminal device can still maintain data upload accuracy under the condition of a poor network bandwidth, and ensure that a network system operates normally.
In order to achieve the purpose, the invention adopts the following technical scheme:
an Internet of things uploading parameter automatic adjusting method comprises the following steps:
detecting the network bandwidth of the current network environment according to a preset time interval to obtain a network bandwidth value;
matching the network bandwidth value with a preset bandwidth class library to obtain uploading parameters of corresponding bandwidth classes;
and adjusting the current data uploading parameters to the uploading parameters, and uploading the data according to the uploading parameters.
Preferably, in the method for automatically adjusting internet of things upload parameters, the matching the network bandwidth value with a preset bandwidth class library to obtain upload parameters of corresponding bandwidth classes includes:
and matching the network bandwidth value with at least two bandwidth ranges in the preset bandwidth class library to obtain the uploading parameters of the corresponding bandwidth ranges.
Preferably, in the method for automatically adjusting internet of things upload parameters, the matching between the network bandwidth value and at least two bandwidth ranges in the preset bandwidth class library to obtain the upload parameters of corresponding bandwidth ranges includes:
when the network bandwidth value is determined to be larger than or equal to a first preset bandwidth, acquiring a first uploading parameter as the uploading parameter;
when the network bandwidth value is determined to be smaller than the first preset bandwidth and larger than or equal to a second preset bandwidth, acquiring a second uploading parameter as the uploading parameter;
when the network bandwidth value is determined to be smaller than the second preset bandwidth and larger than or equal to a third preset bandwidth, acquiring a third uploading parameter as the uploading parameter;
and when the network bandwidth value is determined to be smaller than the third preset bandwidth, acquiring a fourth uploading parameter as the uploading parameter.
Preferably, in the method for automatically adjusting the internet of things upload parameter, the upload parameter includes a data upload frequency and/or a data compression percentage.
Preferably, in the method for automatically adjusting the internet of things upload parameters, the first preset bandwidth is 20kb/s, the second preset bandwidth is 10kb/s, and the third preset bandwidth is 5 kb/s.
Preferably, in the method for automatically adjusting the internet of things upload parameter, the first upload parameter includes that the data upload frequency is 1s once, and the data compression percentage is 0;
the second uploading parameter comprises that the data uploading frequency is once in 2s, and the data compression percentage is 30%;
the third uploading parameter comprises that the data uploading frequency is 3s once, and the data compression percentage is 50%;
the fourth uploading parameter comprises that the data uploading frequency is 4s once, and the data compression percentage is 70%.
The invention also provides an automatic adjustment device for the uploading parameters of the Internet of things, which comprises:
the bandwidth value acquisition module is used for detecting the network bandwidth of the current network environment according to a preset time interval and acquiring a network bandwidth value;
the uploading parameter matching module is used for matching the network bandwidth value with a preset bandwidth class library to obtain uploading parameters of corresponding bandwidth classes;
and the uploading parameter adjusting module is used for adjusting the current data uploading parameters into the uploading parameters and uploading the data according to the uploading parameters.
Preferably, in the internet of things upload parameter automatic adjustment device, the upload parameter matching module includes:
and the bandwidth range matching unit is used for matching the network bandwidth value with at least two bandwidth ranges in the preset bandwidth class library to acquire the uploading parameters of the corresponding bandwidth ranges.
The invention also provides terminal equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal equipment to execute the method for automatically adjusting the internet of things uploading parameters.
The invention also provides a readable storage medium, which stores a computer program, and the computer program executes the method for automatically adjusting the internet of things uploading parameters when running on a processor.
The invention provides an automatic adjustment method for Internet of things uploading parameters, which comprises the following steps: detecting the network bandwidth of the current network environment according to a preset time interval to obtain a network bandwidth value; matching the network bandwidth value with a preset bandwidth class library to obtain uploading parameters of corresponding bandwidth classes; and adjusting the current data uploading parameters to the uploading parameters, and uploading the data according to the uploading parameters. According to the automatic adjustment method for the uploading parameters of the Internet of things, the current network bandwidth of the terminal equipment is detected in real time, the grade of the current network bandwidth is determined, and the corresponding uploading parameters can be obtained to adjust the data uploading, so that the data uploading precision of the terminal equipment can be still maintained under the condition that the network bandwidth is poor, and the normal operation of an Internet of things system is guaranteed.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
Example 1
Fig. 1 is a flowchart of an internet of things upload parameter automatic adjustment method provided in embodiment 1 of the present invention, where the method includes the following steps:
step S11: and detecting the network bandwidth of the current network environment according to a preset time interval to obtain a network bandwidth value.
In the embodiment of the invention, in the internet of things system, the terminal equipment is usually arranged for acquiring the working condition data of the equipment connected with the terminal equipment, so that the working condition data is preliminarily arranged and then uploaded to the server. The terminal equipment is also an internet of things box, when working condition data of the connecting equipment are collected, in order to guarantee the precision of the equipment data, the data collection frequency needs to be kept unchanged, and when the collected data are uploaded to a server, the data are influenced by network bandwidth, and uploading parameters of the data uploaded to the server can be dynamically adjusted according to the current network bandwidth.
In the embodiment of the present invention, an application program for detecting the network bandwidth of the current network environment may be set in the terminal device, and the application program may perform connection detection with the server according to a preset time interval to obtain the network bandwidth between the terminal device and the server, that is, the data upload rate of the terminal device.
Step S12: and matching the network bandwidth value with a preset bandwidth class library to acquire uploading parameters of corresponding bandwidth classes.
In the embodiment of the invention, after the current network bandwidth value of the terminal equipment is obtained, the current network bandwidth value can be matched with a preset bandwidth class library so as to determine the class of the current network bandwidth. The preset bandwidth level library can be provided with a plurality of network bandwidth levels, each network bandwidth level corresponds to a network bandwidth range, for example, the network bandwidth range corresponding to the a-level network bandwidth is 0-5 kb/s, the network bandwidth range corresponding to the B-level network bandwidth is 5-10 kb/s, the network bandwidth range corresponding to the C-level network bandwidth is 10-15 kb/s, and the like, the network bandwidth can be divided into a plurality of levels according to the requirements of users, each level can respectively correspond to an upload parameter of data transmission, and the upload parameter corresponding to the network bandwidth level can also be stored in the preset bandwidth level library.
In this embodiment of the present invention, the process of matching the network bandwidth value with the preset bandwidth class library may be implemented by using an algorithm or an application program, for example, an application program for matching the network bandwidth class may be stored in the terminal device in advance, and after the current network bandwidth value is obtained, the current network bandwidth value may be input to the application program to determine the class corresponding to the network bandwidth value, so as to obtain the corresponding upload parameter according to the class.
In the embodiment of the present invention, the upload parameter includes a data upload frequency and/or a data compression percentage, that is, according to the current network bandwidth value, the terminal device may automatically adjust the data upload frequency or the data compression percentage, and may also simultaneously adjust the data upload frequency and the data compression percentage. For example, in the case of a low bandwidth, the terminal device keeps the frequency of collecting the condition data, and when uploading the condition data, the uploading frequency may be reduced, for example, from the uploading frequency of once every 1 second to once every 3 seconds, or the data compression percentage may be increased, for example, from 0 data compression percentage to 30% data compression percentage, or may be increased from 0 data compression percentage to 30% data compression percentage while reducing the uploading frequency to once every 3 seconds.
Step S13: and adjusting the current data uploading parameters to the uploading parameters, and uploading the data according to the uploading parameters.
In the embodiment of the invention, the current network bandwidth of the terminal equipment is detected in real time, and the grade of the current network bandwidth is determined, so that the corresponding uploading parameters can be obtained to adjust the data uploading, the data uploading precision can be still maintained under the condition that the network bandwidth of the terminal equipment is poor, and the normal operation of an Internet of things system is ensured.
Example 2
Fig. 2 is a flowchart of an internet of things upload parameter automatic adjustment method provided in embodiment 2 of the present invention, where the method includes the following steps:
step S21: and detecting the network bandwidth of the current network environment according to a preset time interval to obtain a network bandwidth value.
This step is identical to step S11 described above, and will not be described herein again.
Step S22: and matching the network bandwidth value with at least two bandwidth ranges in the preset bandwidth class library to obtain the uploading parameters of the corresponding bandwidth ranges.
In the embodiment of the present invention, the preset bandwidth class library includes at least two bandwidth ranges, each of the bandwidth ranges corresponds to one bandwidth class, and when the network bandwidth value is matched with the preset bandwidth class library and falls into one of the bandwidth ranges, the corresponding bandwidth class and the corresponding upload parameter can be determined.
Step S23: and adjusting the current data uploading parameters to the uploading parameters, and uploading the data according to the uploading parameters.
This step is identical to step S13 described above, and will not be described herein again.
Fig. 3 is a flowchart of upload parameter matching according to embodiment 2 of the present invention, where the flowchart includes the following steps:
step S31: and when the network bandwidth value is determined to be larger than or equal to a first preset bandwidth, acquiring a first uploading parameter as the uploading parameter.
Step S32: and when the network bandwidth value is determined to be smaller than the first preset bandwidth and larger than or equal to a second preset bandwidth, acquiring a second uploading parameter as the uploading parameter.
Step S33: and when the network bandwidth value is determined to be smaller than the second preset bandwidth and larger than or equal to a third preset bandwidth, acquiring a third uploading parameter as the uploading parameter.
Step S34: and when the network bandwidth value is determined to be smaller than the third preset bandwidth, acquiring a fourth uploading parameter as the uploading parameter.
As a preferred embodiment, the preset bandwidth level library may store successively smaller preset bandwidth values to indicate the bandwidth ranges, for example, the first preset bandwidth, the second preset bandwidth and the third preset bandwidth are successively smaller, such as the first preset bandwidth is 20kb/s, the second preset bandwidth is 10kb/s and the third preset bandwidth is 5kb/s, the network bandwidth may be divided into four bandwidth ranges, the first range is set when the bandwidth is greater than 20kb/s, the second range is set when the bandwidth is 20kb/s to 10kb/s, the third range is set when the bandwidth is 10kb/s to 5kb/s, and the fourth range is set when the bandwidth is 5kb/s to 0 kb/s. The four bandwidth ranges correspond to different uploading parameters, that is, different data uploading frequencies and/or data compression percentages, and the data uploading frequencies and the data compression percentages can be obtained by data uploading experiments, which are not limited herein, or can be adjusted by a terminal device user. The first uploading parameter comprises that the data uploading frequency is 1s once, and the data compression percentage is 0; the second uploading parameter comprises that the data uploading frequency is once in 2s, and the data compression percentage is 30%; the third uploading parameter comprises that the data uploading frequency is 3s once, and the data compression percentage is 50%; the fourth upload parameters included a data upload frequency of 4s once and a data compression percentage of 70%.
In this embodiment of the present invention, the process of comparing the network bandwidth value with the preset bandwidth may be implemented by using an algorithm or an application program, for example, an application program for comparing the size may be set in the terminal device, and the current network bandwidth value is input to the application program, and the application program may successively compare the network bandwidth value with the first preset bandwidth, the second preset bandwidth, the third preset bandwidth, and the fourth preset bandwidth, so as to obtain the corresponding upload parameter.
Example 3
Fig. 4 is a schematic structural diagram of an internet of things upload parameter automatic adjustment device provided in embodiment 3 of the present invention.
This thing networking uploads automatic adjustment of parameter device 400 includes:
a bandwidth value obtaining module 410, configured to detect a network bandwidth of a current network environment according to a preset time interval, and obtain a network bandwidth value;
the upload parameter matching module 420 is configured to match the network bandwidth value with a preset bandwidth class library to obtain an upload parameter of a corresponding bandwidth class;
and an upload parameter adjusting module 430, configured to adjust the current data upload parameter to the upload parameter, and upload data according to the upload parameter.
As shown in fig. 5, the upload parameter matching module 420 includes:
the bandwidth range matching unit 421 is configured to match the network bandwidth value with at least two bandwidth ranges in the preset bandwidth class library to obtain the upload parameter of the corresponding bandwidth range.
In the embodiment of the present invention, for more detailed description of functions of the modules, reference may be made to contents of corresponding parts in the foregoing embodiment, which are not described herein again.
In addition, the invention also provides a terminal device, which comprises a memory and a processor, wherein the memory can be used for storing a computer program, and the processor enables the terminal device to execute the method or the functions of each module in the internet of things uploading parameter automatic adjusting device by running the computer program.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The embodiment also provides a readable storage medium for storing the computer program used in the terminal device.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.