Data interaction method and device
By setting different data interaction start times for the central device and peripheral devices, the conflict problem when multiple peripheral devices interact with the central device in wireless data is solved, normal and effective data interaction is achieved, and the power consumption of peripheral devices is reduced.
Patent Information
- Application Number
- CN202310173904.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
When multiple peripheral devices interact with the central device wirelessly, conflicts at the interaction time may easily occur, resulting in data interaction failure and increased power consumption of the peripheral devices.
By setting different starting times for data interaction between the central device and different peripheral devices in each interaction cycle, and the central device sending broadcast data and wireless connection instructions, the peripheral devices determine the interaction time based on the received instructions to avoid multiple interactions at the same time. Peripheral devices exchange data with the central device.
It effectively avoids conflicts during data interaction, ensures normal interaction between the central device and peripheral devices, reduces the power consumption of peripheral devices, and improves data interaction efficiency.
Smart Images

Figure CN118574082A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a data interaction method and device. Background Art
[0002] In the scenario where information needs to be collected, a central device and multiple peripheral devices may be included. The peripheral devices and the central device may be wirelessly connected. The central device may send control information to the peripheral devices to instruct the peripheral devices to collect information. The peripheral devices may report the collected information to the central device to realize information collection. For example, when managing a warehouse, there are multiple shelves in the warehouse, and goods are placed on the shelves. The shelves are provided with processors and are called peripheral devices. The warehouse is provided with a manager and is called a central device. The peripheral devices may collect information about the goods placed on the shelves to determine whether the quantity of the goods and the placement of the goods have changed, and report these changes to the central device to facilitate the collection of goods information so that the goods can be managed. In such a scenario, to realize information collection, the peripheral devices need to interact with the central device for data. When multiple peripheral devices need to interact with the central device for data, how to avoid conflicts during interaction has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0003] The embodiment of the present invention provides a data interaction method and device, which are used to avoid conflicts when performing data interaction and ensure that a central device and peripheral devices can perform data interaction normally and effectively.
[0004] In a first aspect, an embodiment of the present invention provides a data interaction method, which is applied to a peripheral device and may include:
[0005] In any one of the set multiple interaction cycles, the following process is performed for any one of the at least one peripheral device:
[0006] When the current peripheral device determines that it is not wirelessly connected to the central device, it receives broadcast data sent by the central device and sends a wireless connection request to the central device;
[0007] The current peripheral device receives the wireless connection indication sent by the central device, and performs data exchange with the central device;
[0008] Wherein, in each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
[0009] In a second aspect, an embodiment of the present invention provides a data interaction method, which is applied to a central device and may include:
[0010] In any of the set multiple interaction cycles, the following process is performed:
[0011] The central device sends broadcast data;
[0012] The central device receives a wireless connection request sent by any peripheral device, sends a wireless connection instruction to the peripheral device, and exchanges data with the peripheral device;
[0013] Wherein, in each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
[0014] In a third aspect, an embodiment of the present invention provides a peripheral device, including:
[0015] A memory for storing program instructions;
[0016] The processor is used to call the program instructions stored in the memory and execute the data interaction method introduced in the first aspect according to the obtained program.
[0017] In a fourth aspect, an embodiment of the present invention provides a central device, including:
[0018] A memory for storing program instructions;
[0019] The processor is used to call the program instructions stored in the memory and execute the data interaction method introduced in the second aspect according to the obtained program.
[0020] In a fifth aspect, an embodiment of the present invention provides a data interaction system, comprising: the peripheral device as described in the third aspect above, and the central device as described in the fourth aspect above;
[0021] The central device is wirelessly connected to the peripheral device.
[0022] The beneficial effects of the present invention are as follows:
[0023] An embodiment of the present invention provides a data interaction method and device. When a peripheral device interacts with a central device, the starting time of the data interaction between the central device and different peripheral devices in each interaction cycle is different. This can avoid the central device interacting with multiple peripheral devices at the same time, thereby avoiding conflicts during data interaction and ensuring that the central device and each peripheral device can interact with data normally and effectively. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A timing diagram provided in an embodiment of the present invention;
[0025] Figure 2Another timing diagram provided in an embodiment of the present invention;
[0026] Figure 3 Another timing diagram provided in an embodiment of the present invention;
[0027] Figure 4 A schematic diagram of data interaction provided in an embodiment of the present invention;
[0028] Figure 5 Another timing diagram provided in an embodiment of the present invention;
[0029] Figure 6 A schematic diagram of the structure of a peripheral device provided in an embodiment of the present invention;
[0030] Figure 7 A schematic diagram of the structure of a central device provided in an embodiment of the present invention;
[0031] Figure 8 The present invention provides a data interaction system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the accompanying drawings to describe in detail the specific implementation of a data interaction method and device provided by an embodiment of the present invention. It should be noted that the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0033] Before introducing the technical solution of the embodiment of the present invention, the application scenario of the embodiment of the present invention is first introduced.
[0034] Application scenario 1: When managing a warehouse, there are multiple shelves in the warehouse with goods placed on them. The shelves are equipped with processors and are called peripheral devices. The warehouse is equipped with a manager and is called a central device. The peripheral devices can be wirelessly connected to the central device, and the peripheral devices can collect information about the goods placed on the shelves to determine whether the quantity of the goods and the placement of the goods have changed, and then feed back these changes to the central device for the management of the goods.
[0035] Application scenario 2: When managing classroom discipline, each desk used by students is installed with a manager and is called a peripheral device. The desk used by the teacher is also installed with a manager and is called a central device. The peripheral devices can be wirelessly connected to the central device. The peripheral devices can collect usage information of the corresponding desks, such as whether there are students sitting down, speech information of seated students, etc., and then transmit the collected information to the central device to assist teachers in recording students' attendance or listening conditions, thereby managing classroom discipline.
[0036] In actual situations, the application scenarios of the embodiments of the present invention are not limited to the above two application scenarios, and can also be applied to scenarios such as automatic meter reading. As long as the scenario needs to collect information, the embodiments of the present invention are applicable.
[0037] In the prior art, taking the Bluetooth connection between the central device and the peripheral device as an example, the Bluetooth Low Energy (BLE) technology can be used to realize data interaction. The specific implementation process may include the following two methods:
[0038] Method 1:
[0039] like Figure 1 As shown in the timing diagram, peripheral devices (such as Figure 1 The working modes of the peripheral devices 1, 2 and 3 shown in the figure may include a broadcast mode and an interactive mode. In the broadcast mode, each peripheral device may periodically send broadcast data (such as A1 and A2) and wait for the central device to connect. The peripheral devices are independent of each other, so there is no sequence when the peripheral devices send broadcast data. When the central device needs to wirelessly connect to a peripheral device (assuming it is peripheral device 2), it receives the broadcast data A2 sent by peripheral device 2 and sends a wireless connection indication I2 to peripheral device 2. When peripheral device 2 completes the wireless connection with the central device, peripheral device 2 stops sending broadcast data, exchanges data with the central device, and enters the interactive mode.
[0040] Taking peripheral device 2 as an example, in the interactive mode, link 2 is established between peripheral device 2 and central device. Link 2 has multiple link cycles. After the first link cycle ends, the second link cycle begins soon. After the second link cycle ends, the third link cycle begins soon. And so on. Generally, there is no time interval between two adjacent link cycles. Figure 1 FIG. 4 shows only the first link cycle and a part of the second link cycle in link 1, link 2 and link 3. In addition, at the start time of each link cycle, the central device exchanges data with the peripheral device 2.
[0041] This approach has the following problems:
[0042] When multiple peripheral devices are wirelessly connected to the central device, there may be a phenomenon where the start times of the link cycles of multiple peripheral devices and the central device overlap, such as Figure 1 As shown, the starting time of the second link cycle in link 1 is T0, and the starting time of the second link cycle in link 2 is also T0, so that the central device needs to interact with peripheral device 1 and peripheral device 2 at the same time, which may cause conflicts during data interaction, and thus cause the central device and the peripheral device to be unable to interact with data normally.
[0043] Furthermore, since peripheral devices periodically send broadcast data, in order to reduce power consumption, the time interval between sending broadcast data is generally relatively large. When the central device wants to connect with the peripheral device, it needs to scan the broadcast, but the central device does not know when the peripheral device will send the broadcast data. Therefore, the central device needs to set a longer scanning time in order to scan the broadcast data and realize the wireless connection with the peripheral device. If the working time of the central device includes scanning time and interaction time, a too long scanning time will result in a too short interaction time, which may affect the data interaction between the central device and the peripheral device.
[0044] In addition, since the peripheral device does not know when the central device sends the wireless connection indication, the peripheral device will continue to send broadcast data, which will increase the power consumption of the peripheral device.
[0045] Method 2:
[0046] like Figure 2 As shown in the timing diagram, in this mode 2, the central device can periodically send broadcast data and wait for the peripheral device to send a wireless connection indication; the peripheral device scans the broadcast data, and when a peripheral device (assuming it is peripheral device 1) needs to connect to the central device, peripheral device 1 receives the broadcast data A1 sent by the central device and sends a wireless connection indication I1 to the central device. When peripheral device 1 completes the wireless connection with the central device, the central device and peripheral device 1 exchange data.
[0047] Therefore, the difference between this method 2 and the above method 1 is that: the device sending the broadcast data is different, the device scanning the broadcast data is different, and the device sending the wireless connection indication is different. However, the similarity between this method 2 and the above method 1 is that: taking peripheral device 1 as an example, when the central device is wirelessly connected to peripheral device 1, link 1 is established between peripheral device 1 and the central device, and there are multiple link cycles in link 1. The setting method of the link cycle is the same in the two methods. In this way, when multiple peripheral devices are wirelessly connected to the central device, there may be a situation where the starting time of the link cycle of multiple peripheral devices and the central device overlaps, such as Figure 2As shown in , the starting time of the second link cycle of link 1 is T1, and the starting time of the second link cycle of link 2 is also T1, so that the central device needs to exchange data with peripheral device 1 and peripheral device 2 at the same time at T1, which may cause conflicts during data interaction, and thus cause the central device and the peripheral device to be unable to exchange data normally.
[0048] exist Figure 1 and Figure 2 In the figure, A1 and A2 both represent broadcast data, I1, I2 and I3 both represent sent wireless connection indications, I1', I2' and I3' both represent received wireless connection indications, S1, S1', S2 and S2' represent data interaction between the central device and each peripheral device, link 1 represents the link period corresponding to the data interaction between the central device and peripheral device 1, link 2 represents the link period corresponding to the data interaction between the central device and peripheral device 2, link 3 represents the link period corresponding to the data interaction between the central device and peripheral device 3, the dotted arrow represents the data transmission direction, and the time period indicated by the solid arrow represents the link period.
[0049] It should be understood that the above is only explained using the example of the central device and the peripheral device being connected via Bluetooth. When the central device and the peripheral device are connected via other wireless connection methods, there may also be conflicts during data interaction. In order to solve this problem, an embodiment of the present invention provides a data interaction method and device for resolving conflicts occurring during data interaction, thereby ensuring that normal and effective data interaction can be performed between the central device and each peripheral device.
[0050] Specifically, a data interaction method provided by an embodiment of the present invention can be applied to a data interaction system, which includes a central device and at least one peripheral device. The central device is wirelessly connected to the peripheral device. The wireless connection method may include but is not limited to: Bluetooth, infrared, radio frequency signals, etc.
[0051] See also Figure 3 The timing diagram shown, and Figure 4 The interaction diagram shown in Figure 3 In the figure, A1, A2 and A3 all represent the broadcast data sent, I1, I2 and I3 all represent the wireless connection indications sent by the central device, I1', I2' and I3' all represent the wireless connection indications received by the three peripheral devices, P1, P2 and P3 all represent the wireless connection requests sent by the three peripheral devices, P1', P2' and P3' all represent the wireless connection requests received by the central device, S1, S1', S2 and S2' represent the data interaction between the central device and each peripheral device, the dotted arrows represent the data transmission direction, and the time period indicated by the solid arrows represents the interaction cycle.
[0052] like Figure 3 and Figure 4 As shown, the data interaction method provided by the embodiment of the present invention is applied to a data interaction system, the data interaction system includes a central device and at least one peripheral device, and the data interaction method may include:
[0053] In any of the multiple interaction cycles that are set, the following process is performed:
[0054] S401, the central device sends broadcast data;
[0055] The broadcast data may be sent sequentially, and the time interval between two adjacent broadcast data may be the same, in which case the broadcast data is sent periodically; or the time interval between two adjacent broadcast data is different, in which case the broadcast data is sent non-periodically.
[0056] Furthermore, the time interval between sending two adjacent broadcast data can be set according to factors such as the duration of the interaction cycle and the number of peripheral devices, and is not limited here.
[0057] S402, the peripheral device x determines whether it has been wirelessly connected to the central device; if not, execute S403; if yes, execute S406;
[0058] The peripheral device x may be any one of all the peripheral devices.
[0059] S403, the peripheral device x receives the broadcast data and sends a wireless connection request to the central device;
[0060] Each peripheral device can receive broadcast data.
[0061] Furthermore, the wireless connection request may carry information such as the identifier of the peripheral device x, so that the central device can identify the sender of each wireless connection request.
[0062] S404, when the central device receives the wireless connection request sent by the peripheral device x, the central device sends a wireless connection instruction to the peripheral device x;
[0063] The wireless connection indication sent by the central device may be used to instruct the peripheral device x to determine a corresponding start time based on the received wireless connection indication, so that the peripheral device x knows when to perform data interaction with the central device.
[0064] Among them, the central device can receive wireless connection requests sent by multiple peripheral devices simultaneously or sequentially. At this time, the central device can send wireless connection instructions to each peripheral device that sends the wireless connection request in turn, and the information carried in each wireless connection instruction is different, so that each peripheral device that receives the wireless connection instruction determines a different starting time for data interaction, so that the data interaction time between the central device and each peripheral device is staggered to avoid conflicts.
[0065] S405, when the peripheral device x receives the wireless connection instruction, it exchanges data with the central device; the process ends;
[0066] S406: The peripheral device x exchanges data with the central device.
[0067] In each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different. Figure 3 As shown, the starting time of data interaction between the central device and the peripheral device 1 is O3, the starting time of data interaction between the central device and the peripheral device 2 is O4, and the starting time of data interaction between the central device and the peripheral device 3 is O5. O3 is earlier than O4, and O4 is earlier than O5.
[0068] In this way, when the peripheral device interacts with the central device, since the starting time of the data interaction corresponding to different peripheral devices in each interaction cycle is different, it is possible to avoid the central device interacting with multiple peripheral devices at the same time, thereby avoiding conflicts during data interaction and ensuring that the central device and each peripheral device can interact with each other normally and effectively.
[0069] Furthermore, during the process of establishing a connection, a wireless connection request is added (such as Figure 3 P1, P2 and P3 in the figure), and the central device sending the broadcast data sends a wireless connection indication (such as Figure 3 I1, I2 and I3 in the figure) make the central device act as the master device and the peripheral device act as the slave device, avoiding the conflict problem of interactive links between different peripheral devices when the peripheral device acts as the master device. At the same time, the scanning time of the central device for broadcast data is removed, and the scanning action is performed by the peripheral device, which can provide more time for data interaction between the central device and the peripheral device.
[0070] In addition, since the broadcast data is transmitted by the central device rather than by the peripheral device, the power consumption of the peripheral device due to the transmission of the broadcast data can be reduced.
[0071] It should be emphasized that on the central device side, there is no need to execute the steps of scanning broadcast data, but only to send broadcast data, receive wireless connection requests and send wireless connection indications. If the steps of sending broadcast data, receiving wireless connection requests and sending wireless connection indications are collectively referred to as connection steps, the time occupied by the connection steps is relatively fixed. When the duration of the interaction cycle is set longer, the proportion of the connection steps will be smaller, providing more time for data interaction, and at the same time achieving the purpose of data interaction with more peripheral devices; and, even if the central device is already connected to multiple peripheral devices, when a new peripheral device is added, the new peripheral device can still quickly connect to the central device, and there will be no data interaction conflicts.
[0072] In some embodiments, when the judgment result of the above S402 is yes and before executing S406, it can also include: the peripheral device x receives the broadcast data; at this time, for the peripheral device x, when it has been wirelessly connected to the central device, it first receives the broadcast data and then exchanges data with the central device.
[0073] Alternatively, when the judgment result of the above S402 is yes, there is no need to receive the broadcast data, but directly execute S406. At this time, for the peripheral device x, when it has been wirelessly connected to the central device, it does not need to execute the operation of receiving broadcast data, but directly interacts with the central device for data, which can reduce the power consumption of the peripheral device.
[0074] In some embodiments, in the above S404, before sending the wireless connection indication to the peripheral device, it may also include determining that there is idle time in the current interaction cycle, so the wireless connection indication is sent by the central device when determining that there is idle time in the current interaction cycle.
[0075] The idle time is the time in the current interaction cycle excluding the time of sending broadcast data, the time of connecting with connected peripheral devices, and the time of data interaction with connected peripheral devices. The connection time may include the time of waiting for receiving a wireless connection request sent by a peripheral device and the time of sending a wireless connection indication.
[0076] That is to say, if there is no idle time, it means that there is no time to interact with peripheral device x in the current interaction cycle, so there is no need to send a wireless connection instruction; if there is idle time, it means that there is time to interact with peripheral device x in the current interaction cycle, so a wireless connection instruction can be sent. In this way, it can be avoided that the wireless connection instruction is sent but there is no idle time and data interaction with peripheral device x cannot be performed, thereby further ensuring that the central device can interact with each peripheral device normally and effectively.
[0077] In some embodiments, in the above S405 and S406, the data interaction between the peripheral device x and the central device may include: the peripheral device x interacts with the central device when the corresponding starting time is reached; wherein the corresponding starting time of the peripheral device x is: the starting time determined based on the received wireless connection indication when the peripheral device x is wirelessly connected to the central device. In this way, the peripheral device x can determine the corresponding starting time, and thus interact with the central device when the corresponding starting time is reached to avoid conflicts.
[0078] In some embodiments, when determining the start time of data interaction based on the wireless connection indication, the following method may be used:
[0079] Mode 1: The wireless connection indication may carry the start time of the data interaction corresponding to the peripheral device x, so the start time can be directly extracted from the wireless connection indication and thus determined.
[0080] Method 2: The wireless connection indication may carry the sending time of the wireless connection indication, the first time difference between the sending time and the reference time, and the second time difference between the starting time of the data interaction corresponding to the peripheral device x and the reference time. In this way, the starting time of the data interaction corresponding to the peripheral device x may be calculated based on the sending time, the first time difference and the second time difference carried in the wireless connection indication.
[0081] The first time difference and the second time difference may be, but are not limited to, in units of us, without using time slots, and are not limited by multiples of time slots.
[0082] Specifically, calculating the start time of data interaction corresponding to the peripheral device x according to the sending time, the first time difference and the second time difference carried in the wireless connection indication may include:
[0083] Calculate the reference time according to the sending time and the first time difference;
[0084] The starting time of the data interaction corresponding to the peripheral device x is calculated according to the calculated reference time and the second time difference.
[0085] The reference time may be the start time of the current interaction cycle, or the start time of other interaction cycles, or other specific time.
[0086] For example, Figure 5As shown, taking peripheral device 1 and the reference time as the starting time of the current interaction cycle as an example, the time when the central device sends the wireless connection indication to the peripheral device 1 is T3, the starting time of the current interaction cycle is T2, the first time difference is △t1, and △t1=T3-T2, so T2 can be calculated; the second time difference is △t2, the starting time of the data interaction between the peripheral device 1 and the central device is O3, and △t2=O3-T2, so based on the calculated T2, O3 can be calculated, thereby calculating the starting time of the data interaction between the peripheral device 1 and the central device.
[0087] In this way, the starting time of the data interaction corresponding to the peripheral device x can be calculated based on the information carried in the wireless connection indication, thereby facilitating the data interaction.
[0088] Of course, the above are just two ways to determine the start time of data interaction. In actual situations, it may not be limited to the above methods 1 and 2, and other methods known to those skilled in the art may also be used to determine the start time of data interaction, which is not limited here.
[0089] It should be understood that the information carried in the wireless connection indication is not limited to the content introduced in the above-mentioned method 1 and method 2, and may also include other information, such as identification information, etc., which is not limited here.
[0090] In some embodiments, in combination Figure 3 As shown, taking peripheral device 1 as an example, in interaction cycle 1, peripheral device 1 establishes a wireless connection with the central device, and determines the starting time of data interaction (such as O3) based on the wireless connection indication. In interaction cycle 2, since peripheral device 1 is already connected to the central device, there is no need to establish a connection again, and data interaction can be directly performed when O3 arrives. Therefore, the starting time of data interaction in interaction cycle 2 is still O3. Moreover, in the case where peripheral device 1 and the central device are not disconnected, there is no need to establish a connection again in each subsequent interaction cycle, and data interaction can be directly performed when O3 arrives. If peripheral device 1 and the central device are disconnected at a certain moment, peripheral device 1 needs to establish a connection with the central device again to facilitate data interaction, and the central device can still configure the starting time of data interaction with peripheral device 1 as O3, and of course it can also be configured as other moments, which are not limited here.
[0091] In this way, there is no need to repeat the connection process or repeatedly determine the start time of data interaction, thereby reducing the power consumption and computing power of the central device and the peripheral device, and reducing the manufacturing cost of the central device and the peripheral device.
[0092] In some embodiments, the following situations may occur:
[0093] Case 1: Assume that the data interaction system includes n1 peripheral devices, n1 is an integer greater than 1, and before the i-th interaction cycle, i is an integer greater than 1. The n1 peripheral devices have established wireless connections with the central device. Therefore, in the i-th interaction cycle, if there is no newly added peripheral device, then after the central device sends broadcast data, no wireless connection request will be received. At this time, the data interaction method may also include:
[0094] When the central device does not receive a wireless connection request, it exchanges data with the connected peripheral device.
[0095] For example, Figure 3 As shown, in interaction cycle 1, since the three peripheral devices have established wireless connections with the central device and have not been disconnected in interaction cycle 2, the three peripheral devices will no longer send wireless connection requests to the central device in interaction cycle 2, so that when the starting time O3 of the data interaction corresponding to peripheral device 1 is reached, the wireless connection request is still not received. At this time, the central device can directly interact with peripheral device 1. Then, when the starting time O4 of the data interaction corresponding to peripheral device 2 is reached, the central device interacts with peripheral device 2. Then, when the starting time O5 of the data interaction corresponding to peripheral device 3 is reached, the central device interacts with peripheral device 3 and then enters interaction cycle 3. In this way, repeated connections between the central device and the peripheral devices can be avoided, and the power consumption of the central device and the peripheral devices can be reduced.
[0096] Case 2: The central device sends a broadcast data, but due to various reasons, it fails to receive the wireless connection request sent by the peripheral device within the preset time. In this case, the data interaction method may also include:
[0097] When the central device does not receive a wireless connection request within a preset time after the last broadcast data is sent, it continues to send the next broadcast data or stops sending the broadcast data.
[0098] Each interaction cycle may include a broadcast period (such as Figure 3 The time period from the first O0 to O3 in the interactive period (such as Figure 3 The broadcast period is the time period for sending broadcast data, and the interaction period is the time period for data interaction between the central device and the peripheral device. The broadcast period can be earlier than the interaction period; that is, the broadcast period is carried out first, and the interaction period is carried out after the broadcast period ends.
[0099] When the broadcast data is sent non-periodically and no wireless connection request is received within a preset time from the last time the broadcast data was sent: if the end time of the broadcast time period is reached, the sending of the broadcast data can be stopped; or, if the end time of the broadcast time period is not reached, and there is still a period of time (denoted as t1) before the end time of the broadcast time period, and t1 is greater than or equal to the preset sending interval between two adjacent broadcast data, the sending of the broadcast data can be stopped; or, if the end time of the broadcast time period is not reached, and there is still a period of time (denoted as t2) before the end time of the broadcast time period, and t2 is less than the preset sending interval between two adjacent broadcast data, the next broadcast data can be sent.
[0100] The preset time can be set according to actual conditions and is not limited here.
[0101] In this way, it is possible to decide whether to continue sending the broadcast data or to stop sending the broadcast data according to the specific situation, thereby meeting the needs of various application scenarios.
[0102] In some embodiments, the central device may interact with multiple peripheral devices. In this case, the interaction period within the interaction cycle can be set as follows: the interaction period is divided into at least one sub-period, the number of sub-periods is the same as the number of peripheral device connections, and the central device interacts with one of the peripheral devices in each sub-period; the starting time of the data interaction corresponding to the peripheral device x is: the starting time of the sub-period corresponding to the data interaction between the central device and the peripheral device x. In other words, the sub-periods for the central device to interact with each peripheral device can be pre-divided, and the time of each sub-period can be set to be the same or different.
[0103] In this way, the data interaction time between the central device and each peripheral device is different. It can be considered that each peripheral device corresponds to a sub-period of data interaction, so that the starting time of data interaction between the central device and different peripheral devices is different, and the time for data interaction with each peripheral device is staggered to avoid conflicts.
[0104] In some embodiments, when there are fewer peripheral devices connected to the central device, the central device can perform one or more data transmissions with each connected peripheral device, thereby improving the efficiency of data transmission. When a new peripheral device is connected to the central device, the number of data transmissions between the central device and the previously connected peripheral device can be reduced to allow time for data interaction with the new peripheral device. That is, the central device can adjust the length of each sub-period, and adjust the number of sub-periods according to the number of connected peripheral devices, so as to flexibly allocate data interaction between the central device and the peripheral devices.
[0105] Based on the same inventive concept, an embodiment of the present invention further provides a data interaction method, which is applied to a peripheral device and may include:
[0106] In any one of the set multiple interaction cycles, the following process is performed for any one of the at least one peripheral device:
[0107] When the current peripheral device determines that it is not wirelessly connected to the central device, it receives broadcast data sent by the central device and sends a wireless connection request to the central device;
[0108] The current peripheral device receives the wireless connection instruction sent by the central device and exchanges data with the central device;
[0109] In each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
[0110] In some embodiments, the implementation principle of the data interaction method is similar to the implementation principle of the data interaction method applied to the above-mentioned data interaction system. For details, please refer to the above-mentioned embodiments and will not be described in detail here.
[0111] Based on the same inventive concept, an embodiment of the present invention further provides a data interaction method, which is applied to a central device and may include:
[0112] In any of the multiple interaction cycles that are set, the following process is performed:
[0113] The central device sends broadcast data;
[0114] The central device receives a wireless connection request sent by any peripheral device, sends a wireless connection instruction to the peripheral device, and exchanges data with the peripheral device;
[0115] In each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
[0116] In some embodiments, the implementation principle of the data interaction method is similar to the implementation principle of the data interaction method applied to the above-mentioned data interaction system. For details, please refer to the above-mentioned embodiments and will not be described in detail here.
[0117] Based on the same inventive concept, an embodiment of the present invention also provides a peripheral device, the implementation principle of the peripheral device is similar to the implementation principle of the data interaction method on the above-mentioned peripheral device side. The specific implementation method of the peripheral device can refer to the specific embodiment of the above-mentioned data interaction method, and the repeated parts will not be repeated.
[0118] Specifically, an embodiment of the present invention provides a peripheral device, such as Figure 6 As shown, including:
[0119] Memory 601, used for storing program instructions;
[0120] The processor 602 is used to call the program instructions stored in the memory 601 and execute the above-mentioned data interaction method provided in the embodiment of the present invention according to the obtained program.
[0121] Based on the same inventive concept, an embodiment of the present invention also provides a central device, the implementation principle of the central device is similar to the implementation principle of the data interaction method on the above-mentioned central device side. The specific implementation method of the central device can refer to the specific embodiment of the above-mentioned data interaction method, and the repeated parts will not be repeated.
[0122] Specifically, an embodiment of the present invention provides a central device, such as Figure 7 As shown, including:
[0123] Memory 701, used for storing program instructions;
[0124] The processor 702 is used to call the program instructions stored in the memory 701 and execute the above-mentioned data interaction method provided in the embodiment of the present invention according to the obtained program.
[0125] Based on the same inventive concept, the embodiment of the present invention also provides a data interaction system, such as Figure 8 As shown, it includes: the above peripheral device 200 provided by the embodiment of the present invention, and the above central device 100 provided by the embodiment of the present invention, and the peripheral device 200 is wirelessly connected to the central device 100. The number of peripheral devices 200 can be at least one, for example but not limited to Figure 8 The four shown in the figure, in actual situations, the number of peripheral devices 200 can be set according to actual needs and is not limited here.
[0126] In some embodiments, the wireless connection method between the central device and the peripheral device may include but is not limited to: Bluetooth, infrared, radio frequency signals, etc.
[0127] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A data interaction method, characterized in that: include: In any one of the set multiple interaction cycles, the following process is performed for any one of the at least one peripheral device: When the current peripheral device determines that it is not wirelessly connected to the central device, it receives broadcast data sent by the central device and sends a wireless connection request to the central device; The current peripheral device receives the wireless connection indication sent by the central device, and performs data exchange with the central device; Wherein, in each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
2. The method according to claim 1, characterized in that The wireless connection indication is sent by the central device when it is determined that there is idle time in the current interaction cycle, and the idle time is the time in the current interaction cycle excluding the sending time of the broadcast data, the connection time with the connected peripheral device, and the data interaction time with the connected peripheral device.
3. The method according to claim 1, characterized in that Also includes: When the current peripheral device determines that it has been wirelessly connected to the central device, it exchanges data with the central device.
4. The method according to any one of claims 1 to 3, characterized in that: The current peripheral device interacts with the central device for data, including: When the current peripheral device reaches the corresponding starting time, the current peripheral device performs the data interaction with the central device; The starting time corresponding to the current peripheral device is: the starting time determined based on the received wireless connection indication when the current peripheral device is wirelessly connected to the central device.
5. The method according to claim 4, characterized in that Determining the starting time based on the received wireless connection indication includes: The wireless connection indication carries the sending time of the wireless connection indication, the first time difference between the sending time and the reference time, and the second time difference between the starting time and the reference time: Calculating the reference time according to the sending time and the first time difference; The starting time is calculated according to the calculated reference time and the second time difference.
6. A data interaction method, characterized in that: include: In any of the set multiple interaction cycles, the following process is performed: The central device sends broadcast data; The central device receives a wireless connection request sent by any peripheral device, sends a wireless connection instruction to the peripheral device, and exchanges data with the peripheral device; Wherein, in each interaction cycle, the starting time of data interaction between the central device and different peripheral devices is different.
7. The method according to claim 6, characterized in that Also includes: When the central device does not receive the wireless connection request within a preset time after the last sending of the broadcast data, it continues to send the next broadcast data or ends sending the broadcast data.
8. The method according to claim 6, characterized in that Also includes: When the central device does not receive the wireless connection request, the central device exchanges data with the connected peripheral device.
9. The method according to claim 6, characterized in that Also includes: Before sending a wireless connection indication to the peripheral device, determining that there is idle time in the current interaction cycle; The idle time is the time in the current interaction cycle excluding the sending time of the broadcast data, the connection time with the connected peripheral device, and the data interaction time with the connected peripheral device.
10. The method according to claim 6, characterized in that The central device performs data interaction with the peripheral device, including: When the starting time corresponding to the peripheral device is reached, the central device exchanges data with the peripheral device.
11. The method according to claim 6, characterized in that The wireless connection indication is used to instruct the peripheral device to determine the start time based on the received wireless connection indication.
12. The method according to any one of claims 6 to 11, characterized in that: Each of the interaction cycles includes a broadcast period and an interaction period; the broadcast period is a period for sending the broadcast data, and the interaction period is a period for data interaction between the central device and the peripheral device, and the time of the broadcast period is prior to the time of the interaction period; The interaction period is divided into at least one sub-period, the number of sub-periods being the same as the number of connections of the peripheral devices, and the central device performs data interaction with one of the peripheral devices in each sub-period; The starting time corresponding to the peripheral device is: the starting time of the sub-period corresponding to the data interaction between the central device and the peripheral device.
13. A peripheral device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory and execute the data interaction method according to any one of claims 1 to 5 according to the obtained program.
14. A central device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory and execute the data interaction method according to any one of claims 6 to 12 according to the obtained program.
15. A data interaction system, characterized in that: include: The peripheral device as claimed in claim 13, and the central device as claimed in claim 14; The central device is wirelessly connected to the peripheral device.
