Communication method and computer equipment

By carrying target information in the confirmation message in LoRaWAN technology, the node device actively obtains the target data, solving the problem of the server failing to send data within the downlink receiving window, improving data interaction efficiency and success rate, and reducing device power consumption.

CN118784160APending Publication Date: 2024-10-15SHENZHEN MINEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410711802.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-03
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

In the existing LoRaWAN technology, the server can only send confirmation messages and other data through the downlink receiving window after the node device reports data. This has low flexibility and can easily lead to data sending failure, resulting in low data interaction efficiency and increased power consumption.

Method used

By carrying target information in the confirmation message, the node device can actively obtain target data from the server, improving the success rate and flexibility of data acquisition, reducing the number of retransmissions, and reducing device power consumption.

Benefits of technology

It improves the success rate of node devices in obtaining target data, reduces the number of data interaction retransmissions between devices, improves data interaction efficiency and reduces device power consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784160A_ABST
    Figure CN118784160A_ABST
Patent Text Reader

Abstract

The invention discloses a communication method and computer equipment, and belongs to the technical field of communication. The method comprises: after a first device sends a report message to a second device, receiving a first acknowledgement message sent by the second device, the first acknowledgement message being an acknowledgement message for the report message; if the first confirmation message carries target information, the first device obtains target data from the second device, and the target information is used for indicating that the second device needs to send the target data to the first device. According to the application, the second device carries the target information in the first confirmation message, so that the first device can know that the second device has the target data needing to be sent to the first device. The first device can actively acquire the target data from the second device when the second device needs to send the target data. Therefore, not only is the flexibility of obtaining the target data improved, but also the success rate of obtaining the target data by the first equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a communication method and a computer device. Background Art

[0002] Long range low wide area network (LoRaWAN) technology is widely used in smart cities, smart homes, smart agriculture and other fields due to its long-distance communication and low power consumption. LoRaWAN defines the specifications for device registration, data transmission, security authentication and other aspects between node devices and servers so that node devices and servers can communicate.

[0003] In the related art, after a node device reports data to a server, it will briefly open a downlink receiving window so as to receive a confirmation message through the downlink receiving window. After the node device reports data, the server can send a confirmation message to the node device, and in some cases can also send other data to the node device.

[0004] However, in the above method, the server can only use the downlink receiving window after the first device reports data to send some data, which is less flexible. In addition, since the downlink receiving window itself is used to receive confirmation messages, the server is prone to fail when using the downlink receiving window to send other data. Summary of the invention

[0005] The present application provides a communication method and a computer device, which can improve the success rate of a first device obtaining target data. The technical solution is as follows:

[0006] In a first aspect, a communication method is provided, which is applied to a first device, and the method includes:

[0007] Sending a report message to the second device;

[0008] receiving a first confirmation message sent by the second device, where the first confirmation message is a confirmation message of the reported message;

[0009] If the first confirmation message carries target information, target data is obtained from the second device, where the target information is used to indicate that the second device needs to send the target data to the first device.

[0010] In the present application, the second device can inform the first device that the second device has target data that needs to be sent to the first device by carrying the target information in the first confirmation message. When the second device needs to send target data, the first device can actively obtain the target data from the second device. In this way, not only the flexibility of obtaining the target data is improved, but also the success rate of the first device obtaining the target data is improved, and the number of times the second device resends the target data to the first device is reduced. Therefore, not only the power consumption of the first device and the second device can be reduced, but also the data interaction efficiency of the first device and the second device can be improved.

[0011] In a second aspect, a communication method is provided, which is applied to a second device, and the method includes:

[0012] Receiving a report message sent by the first device;

[0013] In a case where target data needs to be sent to the first device, a first confirmation message carrying target information is sent to the first device, where the target information is used to indicate that the second device needs to send the target data to the first device, and the first confirmation message is a confirmation message of the reporting message;

[0014] receiving a data acquisition request sent by the first device;

[0015] The target data is sent to the first device according to the data acquisition request.

[0016] In a third aspect, a communication method is provided, the method comprising:

[0017] The first device sends a reporting message to the second device;

[0018] After receiving the report message, the second device sends a first confirmation message carrying target information to the first device if it is necessary to send target data to the first device, where the target information is used to indicate that the second device needs to send the target data to the first device, and the first confirmation message is a confirmation message of the report message;

[0019] After receiving the first confirmation message, the first device acquires the target data from the second device if the first confirmation message carries the target information.

[0020] In a fourth aspect, a communication system is provided, the communication system comprising a first device and a second device;

[0021] The first device is used to send a reporting message to the second device;

[0022] the second device is configured to, after receiving the reporting message, send a first confirmation message carrying target information to the first device if it is necessary to send target data to the first device, wherein the target information is used to indicate that the second device needs to send the target data to the first device, and the first confirmation message is a confirmation message of the reporting message;

[0023] The first device is further configured to, after receiving the first confirmation message, obtain the target data from the second device in a case where the first confirmation message carries the target information.

[0024] In a fifth aspect, a communication apparatus is provided, where the apparatus is applied to a first device, and the apparatus includes:

[0025] A first sending module, used to send a report message to the second device;

[0026] A receiving module, configured to receive a first confirmation message sent by the second device, where the first confirmation message is a confirmation message for the reported message;

[0027] The first acquisition module is used to acquire target data from the second device if the first confirmation message carries target information, where the target information is used to indicate that the second device needs to send the target data to the first device.

[0028] In a sixth aspect, a communication apparatus is provided, where the apparatus is applied to a second device, and the apparatus includes:

[0029] A first receiving module, used to receive a report message sent by a first device;

[0030] a first sending module, configured to send a first confirmation message carrying target information to the first device when it is necessary to send target data to the first device, wherein the target information is used to indicate that the second device needs to send the target data to the first device, and the first confirmation message is a confirmation message of the reporting message;

[0031] A second receiving module, used to receive a data acquisition request sent by the first device;

[0032] The second sending module is used to send the target data to the first device according to the data acquisition request.

[0033] In the seventh aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the communication method described in the first aspect or the second aspect.

[0034] In an eighth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the communication method described in the first aspect or the second aspect is implemented.

[0035] In a ninth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the steps of the communication method described in the first or second aspect above.

[0036] It can be understood that the beneficial effects of the second to ninth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0038] Figure 1 It is a structural diagram of a communication system provided in an embodiment of the present application;

[0039] Figure 2 is a schematic diagram of a downlink receiving window provided in an embodiment of the present application;

[0040] Figure 3 is a flow chart of a communication method provided by an embodiment of the present application;

[0041] Figure 4 is a flow chart of a channel detection process provided by an embodiment of the present application;

[0042] Figure 5 is a flowchart of a process of sending target data provided by an embodiment of the present application;

[0043] Figure 6 is a flowchart of a process of sending a data acquisition request provided by an embodiment of the present application;

[0044] Figure 7 is a flow chart of another communication method provided by an embodiment of the present application;

[0045] Figure 8 is a structural diagram of a communication device provided in an embodiment of the present application;

[0046] Fig. 9 is a structural diagram of another communication device provided in an embodiment of the present application;

[0047] Fig.10It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0049] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.

[0050] The phrases such as "one embodiment" or "some embodiments" described in the present application mean that the specific features, structures or characteristics described in the embodiment are included in one or more embodiments of the present application. Therefore, the phrases such as "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments" that appear in the differences in the present application do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. In addition, the terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0051] The communication system provided in the embodiment of the present application is explained in detail below.

[0052] Figure 1 is a schematic diagram of a communication system provided in an embodiment of the present application. Figure 1 , the communication system 10 may include: a first device 101 and a second device 102.

[0053] The first device 101 and the second device 102 may communicate via a wired connection or a wireless connection. For example, the first device 101 may communicate with the second device 102 via a gateway device.

[0054] Optionally, the number of the first device 101 may be one, or the number of the first device 101 may be multiple, which is not limited in the embodiment of the present application. In this case, if the number of the first device 101 is multiple, each of the multiple first devices 101 can communicate with the second device 102.

[0055] The first device 101 is a device for detecting data. For example, the first device 101 may be a sensor device, an actuator device, a tracker device, an environmental monitoring device, or a security monitoring device, etc., which is not limited in the present embodiment of the application.

[0056] The first device 101 may send a reporting message to the second device 102 .

[0057] The report message may carry data detected by the first device 101. For example, if the first device 101 is a temperature sensor, the data carried in the report message may be the temperature detected by the temperature sensor; for another example, if the first device 101 is an anemometer, the data carried in the report message may be the wind speed and wind direction detected by the anemometer.

[0058] In some embodiments, the first device 101 sending a report message to the second device 102 may be triggered by the following two situations:

[0059] In the first case, the first device 101 may periodically send a reporting message to the second device 102. Specifically, when the timing duration of the timer reaches the period duration of sending a reporting message to the second device 102, the first device 101 may send a reporting message to the second device 102 and reset the timer. The period duration may be preset. For example, the period duration may be set to 1 week, 2 weeks, 3 weeks, etc., which is not limited in the embodiments of the present application.

[0060] In the second case, when the data detected by the first device 101 meets the preset conditions, a report message can be sent to the second device 102. The preset conditions can be set in advance. For example, the preset conditions can be set according to the device type of the first device 101. For example, if the first device 101 is a temperature sensor, the preset condition can be set to send a report message to the second device 102 when the temperature is detected to be greater than 40°; for another example, if the first device 101 is a water quality testing instrument, the preset condition can be set to send a report message to the second device 102 when the pH value of the water is detected to be greater than 7.5 or less than 6.5.

[0061] In some cases, the first device 101 can also determine whether the detected data meets a preset condition while periodically sending a report message to the second device 102. In this case, when the timing duration of the timer reaches the period duration, the first device 101 sends a report message to the second device 102, and when the detected data meets the preset condition, the first device 101 sends a report message to the second device 102.

[0062] It should be noted that, when the detected data meets the preset condition and the first device 101 sends a reporting message to the second device 102, the first device 101 can reset the timer.

[0063] After receiving the report message sent by the first device 101, the second device 102 may send a confirmation message of the report message to the first device 101, and may further send target data to the first device 101. For example, the second device 102 may be a server, a terminal, etc., which is not limited in the present embodiment.

[0064] For example, the target data may be configuration data for the first device 101, which is not limited in the embodiment of the present application. For example, if the first device 101 is a temperature sensor, the target data may be data for configuring the temperature sensor.

[0065] In some embodiments, the communication protocol between the first device 101 and the second device 102 may be a LoRaWAN communication protocol. In this case, the first device 101 may be a node device and the second device 102 may be a server.

[0066] The LoRaWAN communication protocol defines Class A, Class B and other working modes.

[0067] Among them, Class A mode is the most energy-saving mode. In Class A mode, after the node device sends a report message to the server, it will briefly open two downlink receiving windows to receive data. For example, Figure 2 As shown, the downlink receiving window is usually opened two short intervals after sending the report message. The server will send a confirmation message to the node device after receiving the report message, and will also send the target data to the node device if it needs to send the target data to the node device.

[0068] Class B mode adds periodic opening of the downlink receiving window based on Class A mode. In Class B mode, the node device will periodically open the downlink receiving window to receive data sent by the server.

[0069] However, the downlink receiving window is open for a limited time, and the server can only use the downlink receiving window to send the target data to the node device. It is very likely that the server cannot send the target data completely to the node device within the downlink receiving window, resulting in data transmission failure. In this case, the server needs to resend the target data to the node device, thereby reducing the data interaction efficiency between the node device and the server.

[0070] To this end, an embodiment of the present application provides a communication method, whereby a node device can actively obtain target data from a server, thereby improving the success rate of the node device in obtaining the target data. For example, the communication method can be applied to the above-mentioned Class A mode or Class B mode to improve the two modes and improve the data interaction efficiency between the node device and the server in the two modes.

[0071] The communication method provided in the embodiment of the present application is explained in detail below.

[0072] Figure 3 is a flow chart of a communication method provided by an embodiment of the present application. The method is applied to a first device and a second device, and the first device can be the above Figure 1 Any one of the one or more first devices 101 described in the embodiment, the second device may be Figure 1 The second device 102 described in the embodiment. Figure 3 , the method comprises the following steps:

[0073] Step 301: The first device sends a reporting message to the second device.

[0074] For example, the reporting message may be sent to the second device when the first device meets the reporting period, or the reporting message may be sent to the second device when the first device detects that the data meets a preset condition, which is not limited in the embodiments of the present application.

[0075] In some embodiments, when the first device needs to send a reporting message to the second device, it can detect whether each channel in the target frequency band is occupied; if there is at least one unoccupied channel in the target frequency band, a reporting message is sent to the second device through the unoccupied channel; if all channels in the target frequency band are occupied, re-detect whether each channel in the target frequency band is occupied after a second preset time period.

[0076] The target frequency band is the working frequency band of the first device.

[0077] The second preset duration is the duration during which the first device waits to re-detect whether each channel in the target frequency band is occupied. The second preset duration has an initial value. The initial value can be preset. For example, the initial value of the second preset duration can be set according to demand. For example, the initial value of the second preset duration can be set to 2 seconds, 3 seconds, 4 seconds, etc., which is not limited in the embodiments of the present application.

[0078] If there is at least one channel in the target frequency band that is not occupied, it means that there is currently an available channel in the target frequency band, so the first device can send a report message to the second device through one of the unoccupied channels; if all channels in the target frequency band are occupied, it means that there is currently no available channel in the target frequency band, so the first device may not be able to successfully send a report message to the second device at present, so it can wait for the second preset time and re-detect whether each channel in the target frequency band is occupied, in order to send a report message through an unoccupied channel. In this way, the interference of other devices when the first device sends a report message can be reduced, thereby reducing the probability of failure to send a report message and reducing the number of times the report message is resent, thereby achieving the purpose of reducing the power consumption of the first device.

[0079] In some embodiments, the operation of the first device detecting whether each channel in the target frequency band is occupied can be: for any channel in the target frequency band, when there is no preamble code signal on the channel, the first device determines that the channel is not occupied; when there is a preamble code signal on the channel, the first device determines whether the channel is occupied based on the preamble code signal.

[0080] The preamble signal includes a preamble. The preamble signal may be sent by a device other than the first device.

[0081] If there is no preamble signal on the channel, it means that the channel is not currently transmitting data, that is, the channel is not currently occupied and can be used to send reporting messages; if there is a preamble signal on the channel, it means that the channel may be currently transmitting data, that is, the channel may be currently occupied, so it can be further determined whether the channel is occupied based on the preamble signal.

[0082] In some embodiments, the operation of the first device determining whether the channel is occupied according to the preamble signal may be: if the preamble in the preamble signal is invalid, then the channel is determined to be unoccupied. If the preamble in the preamble signal is valid, then if the signal strength of the preamble signal is less than or equal to a preset signal strength, then the channel is determined to be unoccupied; if the signal strength of the preamble signal is greater than a preset signal strength, then the channel is determined to be occupied.

[0083] For example, the signal strength of a preamble signal may be a received signal strength indicator (RSSI) value of the preamble signal, with the unit being decibel milliwatt (dBm).

[0084] The preset signal strength can be preset. The preset signal strength has an initial value. The initial value of the preset signal strength can be preset. For example, the initial value of the preset signal strength can be set by a technician according to demand.

[0085] For example, the first device may verify whether the preamble is valid by verifying whether the format, length, content, etc. of the preamble in the preamble signal are legal.

[0086] If the preamble code in the preamble code signal is invalid, it means that the data currently transmitted by the channel is invalid data, so it can be determined that the channel is available, that is, the channel is not occupied; if the preamble code in the preamble code signal is valid, it means that the data currently transmitted by the channel is valid data. At this time, it can be further determined whether the signal strength of the preamble code signal is less than or equal to the preset signal strength to determine whether the channel is available.

[0087] If the signal strength of the preamble code signal is less than or equal to the preset signal strength, it means that the signal strength of the preamble code signal is small, which has little impact on the first device sending the report message, so it can be determined that the channel is available, that is, the channel is not occupied; if the signal strength of the preamble code signal is greater than the preset signal strength, it means that the signal strength of the preamble code signal is large, which has a greater impact on the first device sending the report message, and may cause the first device to fail to send the report message, so it can be determined that the channel is unavailable, that is, the channel is occupied.

[0088] In some embodiments, the preset signal strength may be a constant pre-set by a technician.

[0089] In other embodiments, the first device may first determine the preset signal strength each time it detects whether each channel in the target frequency band is occupied. Specifically, the first device obtains one or more target signal strengths, which are signal strengths of communication signals sent by the gateway device that the first device has received most recently one or more times; and determines the preset signal strength based on the one or more target signal strengths.

[0090] Since the one or more target signal strengths can reflect the signal strengths of the first device when it communicated with the gateway device the most recently or multiple times, the signal strength of the first device when it communicates with the gateway device the next time, i.e., the preset signal strength, can be more accurately estimated based on the one or more target signal strengths. In this case, if the signal strength of other devices when communicating with the gateway device is greater than the preset signal strength, it is very likely to affect the communication between the first device and the gateway device.

[0091] In some embodiments, the operation of the first device determining the preset signal strength according to the one or more target signal strengths may be: the first device subtracts a preset value from an average value of the one or more target signal strengths to obtain the preset signal strength.

[0092] The preset value can be preset. For example, the preset value can be set by a technician according to needs. For example, the preset value can be 2dBm, 3dBm, 4dBm, etc., which is not limited in the embodiments of the present application.

[0093] For example, assuming that the average value of the one or more target signal strengths is -70dBm and the preset value is 2dBm, then the preset signal strength is -70dBm minus 2dBm, that is, -72dBm. In this case, if the signal strength of a preamble signal is detected to be -71dBm, -71dBm is greater than -72dBm, indicating that the signal strength of the preamble signal is greater than the preset signal strength, then it can be determined that the channel transmitting the preamble signal is occupied.

[0094] In some embodiments, if the first device detects that only one channel in the target frequency band is unoccupied, it can send a reporting message to the second device through this channel; if the first device detects that there are multiple unoccupied channels in the target frequency band, it can select a channel from the multiple channels and then send a reporting message to the second device through the channel.

[0095] For example, the first device may randomly select a channel from the multiple channels, or the first device may select a channel from the multiple channels in other ways, which is not limited in the embodiments of the present application.

[0096] For ease of understanding, the following Figure 4 The operation of the first device detecting whether each channel in the target frequency band is occupied is described by way of example. Figure 4 , the detection process includes steps 401 to 406.

[0097] Step 401: The first device scans a target frequency band.

[0098] Step 402: The first device detects whether there is a preamble signal on each channel in the target frequency band.

[0099] If there is a preamble signal on one or more channels in the target frequency band, step 403 is executed; if there is no preamble signal on any channel in the target frequency band, step 406 is executed.

[0100] Step 403: The first device detects whether the preamble in the preamble signal on the one or more channels is valid.

[0101] If the preamble code in the preamble code signal on at least one channel among the one or more channels is valid, step 404 is executed; if the preamble code in the preamble code signal on each channel among the one or more channels is invalid, step 406 is executed.

[0102] Step 404: The first device determines whether the signal strength of the preamble signal on the at least one channel is greater than a preset signal strength.

[0103] If the signal strength of the preamble signal on one or more channels in the at least one channel is greater than the preset signal strength, step 405 is executed; if the signal strength of the preamble signal on each channel in the at least one channel is less than or equal to the preset signal strength, step 406 is executed.

[0104] Step 405: The first device waits for a second preset time period, and then re-executes step 401.

[0105] Step 406: The first device sends a reporting message to the second device.

[0106] In some embodiments, the first device may first determine the second preset time length each time it detects whether each channel in the target frequency band is occupied.

[0107] Optionally, the operation for the first device to determine the second preset time length may be: the first device obtains the number of detections; if the number of detections is greater than or equal to m, m detection results are obtained, where m is an integer greater than or equal to 2, and the second preset time length is adjusted according to the m detection results; if the number of detections is less than m, the second preset time length is not adjusted.

[0108] The number of detections is the number of times the first device executes the step of "detecting whether each channel in the target frequency band is occupied" after being powered on.

[0109] The m detection results are the detection results obtained when the first device detects whether each channel in the target frequency band is occupied for the most recent m times.

[0110] m can be preset. For example, m can be set by a technician according to needs. For example, m can be set to 10, 11, 12, etc., which is not limited in the embodiment of the present application.

[0111] In the embodiment of the present application, the second preset time length for waiting for re-detection when detecting whether each channel in the target frequency band is occupied for the first m-1 times can be a fixed initial value. After the number of detections reaches m times, the second preset time length for waiting for re-detection can be adjusted according to the results of the most recent m detections, so that the setting of the second preset time length can be more reasonable.

[0112] In some embodiments, the operation of the first device adjusting the second preset time length according to the m detection results may be: the first device obtains the number of target results in the m detection results, and adjusts the second preset time length according to the number of target results.

[0113] The target result is used to indicate that all channels in the target frequency band are occupied.

[0114] The number of target results in the m detection results can reflect the probability that the target result will appear when the first device re-detects after waiting for the second preset time. Specifically, the larger the number of target results in the m detection results, the higher the frequency of re-detection of the first device in the most recent m detections, and the higher the probability that the target result will appear when the first device re-detects after waiting for the second preset time. The smaller the number of target results in the m detection results, the lower the frequency of re-detection of the first device in the most recent m detections, and the lower the probability that the target result will appear when the first device re-detects after waiting for the second preset time. Therefore, the second preset time can be adjusted according to the number of target results, in order to reduce the probability that the target result will appear when the first device re-detects after waiting for the second preset time, so that the efficiency of sending the report message to the second device can be improved.

[0115] In some embodiments, the operation of the first device adjusting the second preset time length according to the number of target results can be: if the number of target results is less than or equal to the first number, then reducing the second preset time length; if the number of target results is greater than the second number, then increasing the second preset time length, and the second number is greater than the first number.

[0116] The first number can be preset. For example, the first number can be set according to demand. For example, the first number can be set to 0, 1, 2, etc., which is not limited in the embodiment of the present application.

[0117] The second number can be preset. For example, the second number can be set according to demand. For example, the second number can be set to 4, 5, 6, etc., which is not limited in the embodiment of the present application.

[0118] If the number of target results is less than or equal to the first number, it means that the probability of the target result appearing when the first device re-detects after waiting for the second preset time is low. Then the first device can reduce the second preset time to start re-detection as soon as possible.

[0119] If the number of target results is greater than the first number and less than or equal to the second number, it means that the probability of the target result appearing when the first device re-detects after waiting for the second preset time period is moderate, and there is no need to adjust the second preset time period.

[0120] If the number of target results is greater than the second number, it means that the probability of the target result appearing when the first device re-detects after waiting for the second preset time is higher. In this case, the first device can increase the second preset time to delay the timing of re-detection, avoid meaningless detection, reduce the power consumption of the first device, and also reduce the probability of the target result appearing.

[0121] In some cases, if the number of target results is less than or equal to a third number, the second preset time length is reduced by a first multiple; if the number of target results is greater than the third number and less than or equal to the first number, the second preset time length is reduced by a second multiple; if the number of target results is greater than the second number, the second preset time length is increased by a third multiple.

[0122] The first multiple is greater than the second multiple. The first multiple, the second multiple, and the third multiple can be preset. For example, the first multiple, the second multiple, and the third multiple can be set as required. For example, the first multiple can be set to 0.5, 0.51, 0.52, etc., the second multiple can be set to 0.3, 0.31, 0.32, etc., and the third multiple can be set to 2, 2.1, 2.2, etc., which is not limited in the embodiments of the present application.

[0123] For example, it is assumed that the second preset duration is 2 seconds, the first number is 0, the second number is 1, the third number is 4, the first multiple is 0.5, the second multiple is 0.3, the third multiple is 2, and m is 10. The first device obtains 10 detection results. If the number of target results in the 10 detection results is 0, the second preset duration (i.e., 2 seconds) is reduced by 0.5 times, and the second preset duration after reduction is 1 second; if the number of target results in the 10 detection results is 1, the second preset duration is reduced by 0.3 times, and the second preset duration after reduction is 1.4 seconds; if the number of target results in the 10 detection results is any one of 2, 3, and 4, the second preset duration is not adjusted, that is, the second preset duration is 2 seconds; if the number of target results in the 10 detection results is any one of 5, 6, 7, 8, 9, and 10, the second preset duration is increased by 2 times, and the second preset duration after increase is 4 seconds.

[0124] Step 302: After receiving the reporting message sent by the first device, the second device sends a first confirmation message carrying target information to the first device if it is necessary to send target data to the first device.

[0125] The first confirmation message is a confirmation message for the reporting message.

[0126] The target information is used to indicate that the second device needs to send target data to the first device.

[0127] The target data is data that the second device needs to send to the first device. For example, the target data may be data preset in the second device, or the target data may be data sent to the second device by other devices, such as data sent to the second device by a user through a terminal or other device.

[0128] For example, the target data may be configuration data for configuring the first device, which is not limited in the embodiment of the present application.

[0129] In some embodiments, before the second device sends a first confirmation message carrying target information to the first device, it can first determine whether the data volume of the target data is greater than the preset data volume; if the data volume of the target data is greater than the preset data volume, the target data is unpacked to obtain n data packets, where n is the number of data packets; if the data volume of the target data is less than or equal to the preset data volume, the target data is not unpacked, and the target data is sent to the first device as 1 data packet. In this case, the number of data packets is 1, that is, n is 1.

[0130] The preset data volume can be preset. For example, the preset data volume can be set according to demand. For example, the preset data volume can be the maximum data volume that the first device can receive in the downlink receiving window.

[0131] If the data volume of the target data is greater than the preset data volume, it means that the data volume of the target data is large, and the probability that the second device successfully sends the target data to the first device in a single time is low, so the target data can be unpacked to obtain n data packets with smaller data volumes, and the n data packets are divided into n times and sent to the first device, which can improve the success rate of sending the target data; if the data volume of the target data is less than or equal to the preset data volume, it means that the data volume of the target data is small, and the probability that the second device successfully sends the target data to the first device in a single time is high, so there is no need to unpack the target data, that is, the target data can be directly sent to the first device as 1 data packet.

[0132] In this case, the target information may include the number of data packets (ie, n), and may further include an identifier (such as a number) of each of the n data packets.

[0133] After the second device sends the first confirmation message carrying the target information to the first device, Figure 5 As shown, the second device can wait for the first device to send a data acquisition request, and the data acquisition request can carry the identifier of one of the n data packets. After receiving the data acquisition request sent by the first device, the second device sends the corresponding data packet to the first device according to the identifier carried in the data acquisition request.

[0134] Step 303: After receiving the first confirmation message sent by the second device, the first device obtains target data from the second device if the first confirmation message carries target information.

[0135] After receiving the first confirmation message, the first device may parse the first confirmation message to determine whether the first confirmation message carries the target message. If the first confirmation message carries the target message, the first device may obtain the target data from the second device; if the first confirmation message does not carry the target message, the operation ends.

[0136] If the first confirmation message carries target information, it means that the second device has target data to send to the first device, so the first device can obtain the target data from the second device; if the first confirmation message does not carry target information, it means that the second device has no target data to send to the first device, so the first device can end the operation.

[0137] It should be noted that in the related art, after the first device sends a report message to the second device, the second device sends a confirmation message and target data to the first device within the downlink receiving window after the first device sends the report message. The first device only passively receives the target data. Even if the second device has not finished sending the target data within the downlink receiving window, the first device cannot perceive it. In the embodiment of the present application, when the second device needs to send target data, the first device can actively obtain the target data from the second device. Compared with the method in the related art where the first device only passively receives the target data, the method in the embodiment of the present application where the first device actively obtains the target data from the second device is actively controlled by the first device, thereby improving the success rate of the first device in obtaining the target data, thereby reducing the number of times the second device resends the target data to the first device, thereby not only reducing the power consumption of the first device and the second device, but also improving the data interaction efficiency between the first device and the second device.

[0138] In some embodiments, the target information includes the number of data packets (i.e., n), and the operation of step 303 may be: the first device sets i to 0, and sends a data acquisition request to the second device, and the data acquisition request carries the identifier of the i+1th data packet among the n data packets; after the second device receives the data acquisition request sent by the first device, it sends the i+1th data packet to the first device; after the first device receives the i+1th data packet sent by the second device, it determines whether i is equal to n-1, and if i is not equal to n-1, sets i=i+1, and re-executes the step of sending the data acquisition request to the second device and subsequent steps until i is equal to n-1. Wherein, n is a positive integer, and i is an integer greater than or equal to 0 and less than or equal to n-1.

[0139] For example, the identifier of the (i+1)th data packet among the n data packets may be i.

[0140] In the embodiment of the present application, the target data includes n data packets. The first device may send n data acquisition requests to the second device in sequence to acquire the n data packets one by one. Furthermore, the first device may send a data acquisition request for acquiring the next data packet to the second device after receiving the previous data packet sent by the second device.

[0141] In some embodiments, the target information includes a first port number, and the operation of the first device sending a data acquisition request to the second device may be: the first device sends the data acquisition request to a port corresponding to the first port number in the second device, wherein the first port number is the port number of the port in the second device used to acquire the target data.

[0142] In some embodiments, when i is set to 0, the first device also sets the target retry number to 0. If the first device does not receive the i+1th data packet sent by the second device within the first preset time after sending the data acquisition request to the second device, then if the target retry number is less than the preset retry number, the target retry number is increased by 1, and the data acquisition request is resent to the second device; if the first device receives the i+1th data packet sent by the second device within the first preset time after sending the data acquisition request to the second device, the target retry number can be set to 0.

[0143] The target retry count is the number of times the first device repeatedly sends a data acquisition request for acquiring the same data packet to the second device.

[0144] The first preset duration can be preset. For example, the first preset duration can be set to 20 seconds, 25 seconds, 30 seconds, etc., which is not limited in the embodiment of the present application.

[0145] The preset number of retries can be preset. For example, the preset number of retries can be set according to demand. For example, the preset number of retries can be set to 10 times, 15 times, 20 times, etc., which is not limited in the embodiments of the present application.

[0146] If the first device does not receive the i+1th data packet sent by the second device within the first preset time after sending the data acquisition request to the second device, it means that the communication between the first device and the second device may be abnormal. In this case, the first device can first determine whether the target retry number is less than the preset retry number. If the target retry number is less than the preset retry number, it means that retries can still be performed, that is, the data acquisition request can be resent to the second device; if the target retry number is equal to the preset retry number, it means that retries are no longer possible. At this time, it can be determined that the current communication between the first device and the second device is abnormal. In this case, the first device can generate an error log, and when sending a report message to the second device next time, the error log will be carried in the report message and sent to the second device to remind the technician to handle it.

[0147] In some embodiments, when the first device needs to send a data acquisition request to the second device, it can also detect whether each channel in the target frequency band is occupied; if there is at least one unoccupied channel in the target frequency band, the data acquisition request is sent to the second device through the unoccupied channel; if all channels in the target frequency band are occupied, re-detect whether each channel in the target frequency band is occupied after a second preset time period.

[0148] The operation of the first device detecting whether each channel in the target frequency band is occupied is similar to the operation of the first device detecting whether each channel in the target frequency band is occupied in the above step 301, and will not be described in detail in this embodiment of the present application.

[0149] For ease of understanding, the following Figure 6 The process of the first device acquiring target data from the second device is described by way of example. Figure 6 , the process may include the following steps 601 to 608.

[0150] Step 601: The first device sets i to 0, and sets the target number of retries to 0.

[0151] Step 602: The first device sends a data acquisition request for acquiring the (i+1)th data packet to the second device. The data acquisition request carries an identifier of the (i+1)th data packet.

[0152] Step 603: The first device determines whether the (i+1)th data packet sent by the second device is received within a first preset time period.

[0153] If the first device receives the (i+1)th data packet within the first preset time period, step 604 is executed.

[0154] If the first device does not receive the (i+1)th data packet within the first preset time period, step 606 is executed.

[0155] Step 604: The first device determines whether i is equal to n-1, where n is the number of data packets.

[0156] If i is not equal to n-1, it means that the (i+1)th data packet is not the last data packet among the n data packets, that is, the complete target data is not obtained, and step 605 is executed to obtain the next data packet.

[0157] If i is equal to n-1, it means that the i+1th data packet is the last data packet among the n data packets, that is, the complete target data has been obtained, and the operation is terminated.

[0158] Step 605 : The first device sets i=i+1 and sets the target number of retries to 0, and then executes step 602 .

[0159] Step 606: The first device determines whether the target retry number is equal to the preset retry number.

[0160] If the target retry number is equal to the preset retry number, step 607 is executed.

[0161] If the target retry number is not equal to the preset retry number, step 608 is executed.

[0162] Step 607 : The first device increases the target retry count by 1, and then executes step 602 .

[0163] Step 608: The first device determines that acquisition of target data fails, and generates an error log.

[0164] In some cases, after the first device obtains the target data from the second device, it can also perform data processing according to the target data, obtain a processing result, and send the processing result to the second device.

[0165] For example, if the target data is configuration data, then after the first device obtains the target data, it can be configured according to the configuration data, obtain a configuration result after the configuration, and then send the configuration result to the second device.

[0166] In some embodiments, the target information includes a second port number, and the operation of the first device sending the processing result to the second device may be: the first device sends the processing result to a port corresponding to the second port number in the second device.

[0167] The second port number is the port number of the port in the second device that receives the processing result.

[0168] Optionally, when the first device needs to send the processing result to the second device, it can detect whether each channel in the target frequency band is occupied; if there is at least one unoccupied channel in the target frequency band, the processing result is sent to the second device through the unoccupied channel; if all channels in the target frequency band are occupied, re-check whether each channel in the target frequency band is occupied after a second preset time period.

[0169] The operation of the first device detecting whether each channel in the target frequency band is occupied is similar to the operation of the first device detecting whether each channel in the target frequency band is occupied in the above step 301, and will not be described in detail in this embodiment of the present application.

[0170] In some cases, after the first device sends the processing result to the second device, it can receive a second confirmation message sent by the second device, where the second confirmation message is a confirmation message of the processing result.

[0171] For ease of understanding, the following takes the first device as a node device, the second device as a server, and the first device and the second device using the LoraWAN communication protocol and Class A mode as an example. Figure 7 The communication process between the first device and the second device in the embodiment of the present application is illustrated by way of example. Figure 7 , the process may include the following steps 701 to 713.

[0172] Step 701: The node device detects whether each channel in the target frequency band is occupied.

[0173] Step 702: When the node device detects that there is an unoccupied channel in the target frequency band, it sends a reporting message to the server through the unoccupied channel.

[0174] After the node device sends the report message to the server, it may open a downlink receiving window, and monitor a designated downlink channel in the downlink receiving window to receive downlink data from the server.

[0175] Step 703: After receiving the report message, the server sends a first confirmation message to the node device. The first confirmation message carries the number of data packets. Assume that the number of data packets is 2.

[0176] Step 704: After receiving the first confirmation message, the node device detects whether each channel in the target frequency band is occupied.

[0177] Since the data volume of the first confirmation message is relatively small, the node device can usually successfully receive the first confirmation message within the downlink receiving window.

[0178] Step 705: When the node device detects that there is an unoccupied channel in the target frequency band, it sends a data acquisition request to the server through the unoccupied channel. The data acquisition request carries the identifier of the first data packet.

[0179] After the node device sends the data acquisition request to the server, it may open a downlink receiving window and monitor a designated downlink channel in the downlink receiving window to receive downlink data from the server.

[0180] Step 706: After receiving the data acquisition request, the server sends the first data packet to the node device.

[0181] Step 707: After receiving the first data packet, the node device detects whether each channel in the target frequency band is occupied.

[0182] Since the target data is split into n data packets, the data volume of each data packet is relatively small. Therefore, after the server sends one of the data packets to the node device, the node device can usually successfully receive the data packet within the downlink receiving window.

[0183] Step 708: When the node device detects that there is an unoccupied channel in the target frequency band, it sends a data acquisition request to the server through the unoccupied channel, and the data acquisition request carries the identifier of the second data packet.

[0184] After the node device sends the data acquisition request to the server, it may open a downlink receiving window and monitor a designated downlink channel in the downlink receiving window to receive downlink data from the server.

[0185] Step 709: After receiving the data acquisition request, the server sends the second data packet to the node device.

[0186] Step 710: After receiving the second data packet, the node device processes the target data to obtain a processing result.

[0187] Since the number of data packets carried by the first confirmation message is 2, the node device obtains the target data after obtaining the first data packet and the second data packet.

[0188] Step 711: The node device detects whether each channel in the target frequency band is occupied.

[0189] Step 712: When the node device detects that there is an unoccupied channel in the target frequency band, the node device sends the processing result to the server through the unoccupied channel.

[0190] Step 713: After receiving the processing result, the server sends a second confirmation message to the node device, where the second confirmation message is a confirmation message of the processing result.

[0191] In an embodiment of the present application, after the first device sends a report message to the second device, if the first device receives a first confirmation message of the report message sent by the second device, then when the first confirmation message carries target information, the first device actively obtains target data from the second device, and the target information is used to indicate that the second device needs to send target data to the first device. In an embodiment of the present application, when the second device needs to send target data, the first device can actively obtain target data from the second device, thereby not only improving the flexibility of obtaining target data, but also improving the success rate of the first device in obtaining target data, and reducing the number of times the second device resends target data to the first device. In this way, not only the power consumption of the first device and the second device can be reduced, but also the data interaction efficiency of the first device and the second device can be improved.

[0192] Figure 8 is a schematic diagram of the structure of a communication device provided in an embodiment of the present application. The device can be implemented by software, hardware or a combination of both to become part or all of a computer device, and the computer device can be the following Fig.10 Computer equipment shown. Figure 8 The device includes: a first sending module 801, a receiving module 802, and a first obtaining module 803.

[0193] A first sending module 801, configured to send a report message to a second device;

[0194] The receiving module 802 is used to receive a first confirmation message sent by the second device, where the first confirmation message is a confirmation message for the reported message;

[0195] The first acquisition module 803 is configured to acquire target data from the second device if the first confirmation message carries target information, where the target information is used to indicate that the second device needs to send the target data to the first device.

[0196] Optionally, the target information includes the number of data packets, the target data includes n data packets, n is the number of data packets, and the first acquisition module 803 is used to:

[0197] Let i be 0;

[0198] Sending a data acquisition request to the second device, where the data acquisition request carries an identifier of the (i+1)th data packet among the n data packets;

[0199] Receive the (i+1)th data packet sent by the second device;

[0200] Determine whether i is equal to n-1;

[0201] If i is not equal to n-1, then i=i+1 is set, and the step of sending a data acquisition request to the second device and subsequent steps are re-executed until i is equal to n-1.

[0202] Optionally, the target information includes a first port number, and the first acquisition module 803 is used to:

[0203] The data acquisition request is sent to the port corresponding to the first port number in the second device.

[0204] Optionally, the device further comprises:

[0205] The first setting module is used to set the target number of retries to 0 when i is 0;

[0206] Optionally, the device further comprises:

[0207] a resending module, configured to, if the i+1th data packet sent by the second device is not received within a first preset time length after sending the data acquisition request, increase the target retry number by 1 and resend the data acquisition request to the second device if the target retry number is less than the preset retry number;

[0208] The second setting module is used to set the target number of retries to 0 if an i+1th data packet sent by the second device is received within a first preset time period after sending the data acquisition request.

[0209] Optionally, the device further comprises:

[0210] A processing module is used to process the target data and obtain a processing result;

[0211] The second sending module is used to send the processing result to the second device.

[0212] Optionally, the target information includes a second port number, and the second sending module is used to:

[0213] The processing result is sent to the port corresponding to the second port number in the second device.

[0214] Optionally, the first sending module 801 is used for:

[0215] Detect whether each channel in the target frequency band is occupied;

[0216] If there is at least one unoccupied channel in the target frequency band, sending the reporting message to the second device through the unoccupied channel;

[0217] If all channels in the target frequency band are occupied, the step of detecting whether each channel in the target frequency band is occupied and subsequent steps are re-executed after the second preset time period.

[0218] Optionally, the first sending module 801 is used for:

[0219] For any channel in the target frequency band, when there is no preamble signal on the channel, determining that the channel is not occupied;

[0220] In the case that the preamble signal exists on the channel, whether the channel is occupied is determined according to the preamble signal.

[0221] Optionally, the first sending module 801 is used for:

[0222] If the preamble in the preamble signal is invalid, it is determined that the channel is not occupied;

[0223] If the preamble in the preamble signal is valid, then when the signal strength of the preamble signal is less than or equal to the preset signal strength, it is determined that the channel is not occupied; when the signal strength of the preamble signal is greater than the preset signal strength, it is determined that the channel is occupied.

[0224] Optionally, the device further comprises:

[0225] A second acquisition module, configured to acquire one or more target signal strengths, where the one or more target signal strengths are signal strengths of a communication signal sent by a gateway device that the first device has received one or more times recently;

[0226] The determination module is used to determine a preset signal strength according to the one or more target signal strengths.

[0227] Optionally, the determination module is used to:

[0228] The preset signal strength is obtained by subtracting a preset value from the average value of the one or more target signal strengths.

[0229] Optionally, the device further comprises:

[0230] A third acquisition module is used to acquire a detection number, where the detection number is the number of times the first device performs the step of detecting whether each channel in the target frequency band is occupied after being powered on;

[0231] A fourth acquisition module is used to obtain m detection results if the number of detections is greater than or equal to m, where the m detection results are the detection results obtained when the first device detects whether each channel in the target frequency band is occupied for the most recent m times, and m is an integer greater than or equal to 2;

[0232] An adjustment module is used to adjust the second preset time length according to the m detection results.

[0233] Optionally, the adjustment module is used to:

[0234] Obtaining the number of target results in the m detection results, where the target result is used to indicate that all channels in the target frequency band are occupied;

[0235] The second preset time duration is adjusted according to the number of target results.

[0236] Optionally, the adjustment module is used to:

[0237] If the number of target results is less than or equal to the first number, reducing the second preset time length;

[0238] If the number of target results is greater than the second number, the second preset time length is increased, and the second number is greater than the first number.

[0239] Optionally, the first acquisition module 803 is used to:

[0240] Detect whether each channel in the target frequency band is occupied;

[0241] If there is at least one unoccupied channel in the target frequency band, sending the data acquisition request to the second device through the unoccupied channel;

[0242] If all channels in the target frequency band are occupied, the step of detecting whether each channel in the target frequency band is occupied and subsequent steps are re-executed after the second preset time period.

[0243] In an embodiment of the present application, the second device can inform the first device that the second device has target data that needs to be sent to the first device by carrying the target information in the first confirmation message. When the second device needs to send target data, the first device can actively obtain the target data from the second device. In this way, not only the flexibility of obtaining the target data is improved, but also the success rate of the first device obtaining the target data is improved, and the number of times the second device resends the target data to the first device is reduced. Thereby, not only the power consumption of the first device and the second device can be reduced, but also the data interaction efficiency of the first device and the second device can be improved.

[0244] Fig. 9 is a schematic diagram of the structure of a communication device provided in an embodiment of the present application. The device can be implemented by software, hardware or a combination of both to become part or all of a computer device, and the computer device can be the following Fig.10 Computer equipment shown. Fig. 9 The device includes: a first receiving module 901, a first sending module 902, a second receiving module 903, and a second sending module 904.

[0245] A first receiving module 901 is used to receive a report message sent by a first device;

[0246] A first sending module 902 is used to send a first confirmation message carrying target information to the first device when it is necessary to send target data to the first device, where the target information is used to indicate that the second device needs to send target data to the first device, and the first confirmation message is a confirmation message of the report message;

[0247] A second receiving module 903, configured to receive a data acquisition request sent by the first device;

[0248] The second sending module 904 is configured to send target data to the first device according to the data acquisition request.

[0249] Optionally, the target information includes the number of data packets, and the device further includes:

[0250] The unpacking module is used to unpack the target data if the data volume of the target data is greater than the preset data volume, so as to obtain n data packets, where n is the number of the data packets.

[0251] Optionally, the data acquisition request carries an identifier of the (i+1)th data packet among the n data packets, and the second sending module 904 is used to:

[0252] An i+1th data packet is sent to the first device, where i is an integer greater than or equal to 0 and less than or equal to n-1.

[0253] In an embodiment of the present application, the second device can inform the first device that the second device has target data that needs to be sent to the first device by carrying the target information in the first confirmation message. When the second device needs to send target data, the first device can actively obtain the target data from the second device. In this way, not only the flexibility of obtaining the target data is improved, but also the success rate of the first device obtaining the target data is improved, and the number of times the second device resends the target data to the first device is reduced. Thereby, not only the power consumption of the first device and the second device can be reduced, but also the data interaction efficiency of the first device and the second device can be improved.

[0254] It should be noted that: when the communication device provided in the above embodiment communicates, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0255] The functional units and modules in the above embodiments may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit, and the above integrated units may be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.

[0256] The communication device and communication method embodiments provided in the above embodiments belong to the same concept. The specific working process of the units and modules in the above embodiments and the technical effects brought about can be found in the method embodiment part and will not be repeated here.

[0257] Fig.10 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.10 As shown, the computer device 10 includes: a processor 100, a memory 101, and a computer program 102 stored in the memory 101 and executable on the processor 100. When the processor 100 executes the computer program 102, the operations performed by the first device or the second device in the communication method in the above embodiment are implemented.

[0258] The computer device 10 may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the computer device 10 may be a desktop computer, a portable computer, a network server, a PDA, a mobile phone, a tablet computer, a wireless terminal device, a communication device or an embedded device. The embodiment of the present application does not limit the type of the computer device 10. Those skilled in the art will understand that Fig.10 This is only an example of the computer device 10 and does not constitute a limitation on the computer device 10. The computer device 10 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, such as input and output devices, network access devices, etc.

[0259] The processor 100 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0260] In some embodiments, the memory 101 may be an internal storage unit of the computer device 10, such as a hard disk or memory of the computer device 10. In other embodiments, the memory 101 may also be an external storage device of the computer device 10, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 10. Further, the memory 101 may also include both an internal storage unit of the computer device 10 and an external storage device. The memory 101 is used to store an operating system, an application program, a boot loader, data, and other programs. The memory 101 may also be used to temporarily store data that has been output or is to be output.

[0261] An embodiment of the present application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, and when the processor executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.

[0262] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0263] An embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned method embodiments.

[0264] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.

[0265] It should be understood that all or part of the steps to implement the above embodiments can be implemented 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. The computer instructions can be stored in the above-mentioned computer readable storage medium.

[0266] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0267] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0268] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0269] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0270] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A communication method, characterized in that: Applied to a first device, the method includes: Sending a report message to the second device; receiving a first confirmation message sent by the second device, where the first confirmation message is a confirmation message of the reported message; If the first confirmation message carries target information, target data is obtained from the second device, where the target information is used to indicate that the second device needs to send the target data to the first device.

2. The method according to claim 1, characterized in that The target information includes the number of data packets, the target data includes n data packets, where n is the number of data packets, and acquiring the target data from the second device includes: Let i be 0; Sending a data acquisition request to the second device, where the data acquisition request carries an identifier of the (i+1)th data packet among the n data packets; receiving the (i+1)th data packet sent by the second device; Determine whether i is equal to n-1; If i is not equal to n-1, then i=i+1 is set, and the step of sending a data acquisition request to the second device and subsequent steps are re-executed until i is equal to n-1.

3. The method according to claim 1 or 2, characterized in that The sending a reporting message to the second device includes: Detect whether each channel in the target frequency band is occupied; If there is at least one unoccupied channel in the target frequency band, sending the reporting message to the second device through the unoccupied channel; If all channels in the target frequency band are occupied, the step of detecting whether each channel in the target frequency band is occupied and subsequent steps are re-executed after a second preset time period.

4. The method according to claim 3, characterized in that The detecting whether each channel in the target frequency band is occupied includes: For any channel in the target frequency band, when no preamble signal exists on the channel, determining that the channel is not occupied; In the case where the preamble code signal exists on the channel, if the preamble code in the preamble code signal is invalid, it is determined that the channel is not occupied; if the preamble code in the preamble code signal is valid, if the signal strength of the preamble code signal is less than or equal to the preset signal strength, it is determined that the channel is not occupied, and if the signal strength of the preamble code signal is greater than the preset signal strength, it is determined that the channel is occupied.

5. The method according to claim 3, characterized in that Before detecting whether each channel in the target frequency band is occupied, the method further includes: Obtaining a detection count, where the detection count is the number of times the first device performs the step of detecting whether each channel in the target frequency band is occupied after being powered on; If the number of detections is greater than or equal to m, then m detection results are obtained, where the m detection results are the detection results obtained when the first device detects whether each channel in the target frequency band is occupied for the most recent m times, and m is an integer greater than or equal to 2; The second preset duration is adjusted according to the m detection results.

6. The method according to claim 2, characterized in that The sending a data acquisition request to the second device includes: Detect whether each channel in the target frequency band is occupied; If there is at least one unoccupied channel in the target frequency band, sending the data acquisition request to the second device through the unoccupied channel; If all channels in the target frequency band are occupied, the step of detecting whether each channel in the target frequency band is occupied and subsequent steps are re-executed after a second preset time period.

7. A communication method, characterized in that: Applied to the second device, the method includes: Receiving a report message sent by the first device; In a case where target data needs to be sent to the first device, a first confirmation message carrying target information is sent to the first device, where the target information is used to indicate that the second device needs to send the target data to the first device, and the first confirmation message is a confirmation message of the reporting message; receiving a data acquisition request sent by the first device; The target data is sent to the first device according to the data acquisition request.

8. The method according to claim 7, characterized in that The target information includes the number of data packets, and before sending the first confirmation message carrying the target information to the first device, the method further includes: If the data volume of the target data is greater than the preset data volume, the target data is unpacked to obtain n data packets, where n is the number of the data packets.

9. The method according to claim 8, characterized in that The data acquisition request carries an identifier of the (i+1)th data packet among the n data packets, and sending the target data to the first device according to the data acquisition request includes: The i+1th data packet is sent to the first device, where i is an integer greater than or equal to 0 and less than or equal to n-1.

10. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the method according to any one of claims 1 to 9 when executed by the processor.