Master equipment determination method and device, equipment, storage medium and program product
By setting trigger conditions that allow only one control device to switch at the same time and data verification within the first time period, the problem of poor data consistency caused by the time inconsistency between the master and standby machines is solved, achieving wider applicability and accuracy.
Patent Information
- Application Number
- CN202410526810.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2025-10-28
AI Technical Summary
In system-level control, the timing of control commands issued by the master and standby machines is inconsistent, resulting in poor data transmission consistency in the selection of master and standby devices by the controlled devices. Furthermore, existing technologies are difficult to adapt to complex scenarios with more than two control devices.
By setting the trigger conditions that only allow one control device to switch between the master and backup states at the same time, combined with the control data verification and selection within the first time period, it is ensured that the master and backup selection is based on the data of all control devices, and the master control device is selected using the last master as the master, the highest historical efficiency, or random selection logic.
The effectiveness of master/slave selection is improved, the problem of poor data consistency is reduced, and the applicability of the method is expanded to multiple control device scenarios.
Smart Images

Figure CN120849192A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to, but is not limited to, the field of computer technology, and in particular to a method, apparatus, device, storage medium, and program product for determining a master device. Background Technology
[0002] In the field of system-level control, to ensure the normal operation of services, a master controller and a backup controller are required to control the equipment simultaneously. When the master controller fails, the backup controller can quickly switch to become the master controller to maintain control of the equipment. The controlled equipment will select the primary / backup signal from the two signals and execute the signal determined to be from the master controller.
[0003] In practical applications, the timing of control commands issued by the master and standby machines is often out of sync. The order in which commands arrive and the switching between master and standby devices can affect the controlled device's decision-making when selecting a master or standby device, resulting in poor data transmission consistency. Summary of the Invention
[0004] In view of the above, embodiments of this disclosure provide at least one method, apparatus, device, storage medium, and program product for determining a master device.
[0005] The technical solution of this disclosure embodiment is implemented as follows:
[0006] On one hand, embodiments of this disclosure provide a method for determining a master device, the method comprising: determining whether the current time satisfies a trigger condition that indicates that only one control device is allowed to switch between master and backup states at the same time, based on first control data received from at least one control device at the current time; if the trigger condition is satisfied at the current time, selecting a master control device from the at least one control device based on second control data received from the at least one control device within a first time period after the current time.
[0007] It is understandable that limiting the timing of primary / standby selection by defining the trigger condition that allows only one control device to switch between primary and standby states at any given time can avoid abnormal triggers such as accidental touches. Compared to related technologies where primary / standby switching is easily triggered by accidental touches or other abnormal triggers, this improves the effectiveness of primary / standby selection. When the trigger condition is met, the primary control device is selected from at least one control device based on the second control data received from at least one control device within a first time period after the current time. Thus, the first time period ensures that control data from all control devices can be obtained at any given time, and the selection of primary / standby is based on the control data from all control devices, reducing the problem of poor data consistency caused by inconsistent control device distribution times and improving data consistency. Furthermore, the primary device determination method provided in this disclosure can be applied to scenarios where two or more control devices act on one controlled device, which is more widely applicable and has greater scalability compared to related technologies that only apply to scenarios where two control devices act on one controlled device.
[0008] In some embodiments, determining whether the current time satisfies the triggering condition characterizing that only one control device is allowed to switch between primary and backup states at the same time, based on the first control data received from at least one control device at the current time, includes: verifying the content and validity of the first control data; and, if the content of the first control data is not abnormal and the first control data is valid, determining whether the current time satisfies the triggering condition based on the first control data.
[0009] It is understandable that after receiving the first control data from at least one control device, verifying the content and validity of the first control data before using it to determine the timing of the primary / backup selection logic can improve the accuracy of subsequent processing.
[0010] In some embodiments, verifying the content and validity of the first control data includes: verifying the first control data using a data transmission detection method to determine whether the content of the first control data is abnormal; and matching the value of the switching identifier in the first control data with a preset identifier value to determine whether the first control data is valid.
[0011] It is understandable that different verification methods are used to verify the content and validity of the first control data. By adopting different verification methods for different aspects, the accuracy of verification can be improved.
[0012] In some embodiments, determining whether the triggering condition, which indicates that only one control device is allowed to switch between primary and backup states at the same time, is met based on the first control data received from at least one control device at the current time, includes: determining whether any of the at least one control devices switches from an off-duty state to an on-duty state at the current time, based on the value of the switching identifier in the first control data; wherein the off-duty state indicates that the corresponding control device is a backup control device, and the on-duty state indicates that the corresponding control device is a primary control device; determining whether any of the at least one control devices switches from an on-duty state to an off-duty state at the current time, and all control devices have not switched from an off-duty state to an on-duty state, based on the value of the switching identifier in the first control data; and determining that the triggering condition is met at the current time if any of the at least one control devices switches from an off-duty state to an on-duty state at the current time, or if any of the at least one control devices switches from an on-duty state to an off-duty state at the current time, and all control devices have not switched from an off-duty state to an on-duty state.
[0013] It is understandable that even if the first control data received is valid, it may not necessarily trigger the primary / standby selection logic. Certain triggering conditions must also be met. This can avoid abnormal triggering such as accidental touches. Compared with related technologies, which are prone to primary / standby switching under abnormal triggering such as accidental touches, this improves the effectiveness of primary / standby selection.
[0014] In some embodiments, when the triggering condition is met at the current time, selecting a master control device from the at least one control device based on the second control data received from the at least one control device within a first time period after the current time includes: when the triggering condition is met at the current time, selecting a control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each of the second control data; determining a current selection result based on the temporary selection result, and taking the control device corresponding to the current selection result as the currently selected master control device.
[0015] It is understandable that by using the temporary selection result, the duty status of all control devices is monitored and updated synchronously throughout the process, while by using the current selection result, the selection value is only updated and maintained after the first time period ends; the temporary selection result and the current selection result work together to affect the primary and backup selection logic.
[0016] In some embodiments, when the triggering condition is met at the current moment, selecting a control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each of the second control data includes: when the triggering condition is met at the current moment, switching the channel state machine from an idle state to a waiting state; the channel state machine represents the progress of the current primary / backup selection; receiving the second control data sent by the at least one control device during a first duration when the channel state machine enters the waiting state; and updating the temporary selection result based on the value of the switching identifier in the second control data according to the order of the transmission times.
[0017] It is understandable that by using the first duration, it can be ensured that control data from all control devices can be obtained at the current time. Therefore, the selection of primary and backup devices is based on the control data from all control devices, which reduces the problem of poor data consistency caused by inconsistent control device distribution times and improves data consistency.
[0018] In some embodiments, determining the current selection result based on the temporary selection result and designating the control device corresponding to the current selection result as the currently selected main control device includes: after the channel state machine enters the waiting state for a first duration, switching the channel state machine from the waiting state to the selection state; when the channel state machine enters the selection state, designating the temporary selection result as the current selection result and designating the control device corresponding to the current selection result as the main control device.
[0019] It is understandable that entering the selection state after waiting for the first duration, locking the current selection result and storing the temporary selection result can improve the embodiment of the "later main selection" principle.
[0020] In some embodiments, the master device determination method further includes: after determining the master control device, switching the channel state machine from a selection state to a transmission state; when the channel state machine enters the transmission state, transmitting the control data of the master control device to the target location; after the control data transmission of the master control device is completed, switching the channel state machine from the transmission state to the end state; and after the channel state machine is in the end state, switching the channel state machine from the end state to the idle state.
[0021] It is understandable that the second duration ensures that the data is sent out before entering the next waiting state, which facilitates the next primary / backup selection.
[0022] In some embodiments, the master device determination method further includes: determining that the triggering condition is met at the current moment when the current selection result during the previous master / standby selection is the same as the temporary selection result during the current master / standby selection.
[0023] It is understandable that if the current selection result during the previous primary / standby selection is the same as the temporary selection result during the current primary / standby selection, determining that the triggering condition is met at the current moment and performing primary / standby selection can improve the effectiveness of the selected primary control device.
[0024] In some embodiments, the triggering conditions include at least one of the following: any control device switches from an off-duty state to an on-duty state; any control device switches from an on-duty state to an off-duty state, and none of the control devices switch from an off-duty state to an on-duty state; the current selection result during the last primary / backup selection is the same as the temporary selection result during the current primary / backup selection.
[0025] On the other hand, embodiments of this disclosure provide a master device determination apparatus, the master device determination apparatus comprising: a determination module configured to determine, based on first control data received from at least one control device at the current time, whether the current time satisfies a trigger condition characterizing that only one control device is allowed to switch between master and backup states at the same time; and a selection module configured to, if the trigger condition is satisfied at the current time, select a master control device from the at least one control device based on second control data received from the at least one control device within a first time period after the current time.
[0026] In another aspect, embodiments of this disclosure provide a computer device including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the program to implement some or all of the steps in the above-described method.
[0027] In another aspect, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above-described method.
[0028] In another aspect, embodiments of this disclosure provide a computer program including computer-readable code, which, when executed in a computer device, causes a processor in the computer device to perform some or all of the steps in the above-described method.
[0029] In another aspect, embodiments of this disclosure provide a computer program product, the computer program product including a non-transitory computer-readable storage medium storing a computer program, wherein when the computer program is read and executed by a computer, it implements some or all of the steps in the above method.
[0030] In this embodiment, by defining a trigger condition that allows only one control device to switch between primary and backup states at any given time, the timing of primary / backup selection is limited. This avoids abnormal triggering such as accidental touches, improving the effectiveness of primary / backup selection compared to related technologies where switching is easily triggered by accidental touches or other abnormal events. When the trigger condition is met, a primary control device is selected from at least one control device based on second control data received from at least one control device within a first time period after the current moment. This first time period ensures that control data from all control devices is currently available, thus the primary / backup selection is based on the control data from all control devices, reducing data consistency issues caused by inconsistent control device distribution times and improving data consistency. Furthermore, the primary device determination method provided in this embodiment can be applied to scenarios where two or more control devices act on one controlled device, offering a wider range of applications and greater scalability compared to related technologies that only apply to scenarios where two control devices act on one controlled device.
[0031] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure. Attached Figure Description
[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.
[0033] Figure 1 A schematic diagram of the implementation flow of a master device determination method provided in this embodiment of the disclosure. Figure 1 ;
[0034] Figure 2 This is a schematic diagram of the system composition of a master device determination method provided in an embodiment of this disclosure. Figure 1 ;
[0035] Figure 3 A schematic diagram of the implementation flow of a master device determination method provided in this embodiment of the disclosure. Figure 2 ;
[0036] Figure 4 This is a schematic diagram of the system composition of a master device determination method provided in an embodiment of this disclosure. Figure 2 ;
[0037] Figure 5 A schematic diagram of the implementation flow of a master device determination method provided in this embodiment of the disclosure. Figure 3 ;
[0038] Figure 6A schematic diagram of the state machine changes during the application of a master device determination method provided in this embodiment of the disclosure. Figure 1 ;
[0039] Figure 7 A schematic diagram of the state machine changes during the application of a master device determination method provided in this embodiment of the disclosure. Figure 2 ;
[0040] Figure 8 This is a schematic diagram of the composition structure of a master device determining device provided in an embodiment of this disclosure;
[0041] Figure 9 This is a schematic diagram of the hardware entity of a computer device provided in an embodiment of this disclosure. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this disclosure. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0043] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0044] The terms “first / second / third” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first / second / third” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this disclosure described herein can be implemented in an order other than that illustrated or described herein.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains. The terminology used herein is for descriptive purposes only and is not intended to limit the scope of this disclosure.
[0046] To better understand the master device determination method provided in the embodiments of this disclosure, the solutions in related technologies will be described below.
[0047] The controlled device is connected to two control devices. During normal operation, only one control device is in duty mode, and the control data executed is selected from the control devices in duty mode. The duty mode switching in related technologies follows the following two principles: 1. The last master becomes the master: when both control devices are in duty mode, the control device that last became in duty mode is selected; 2. The original master becomes the master: when both control devices are not in duty mode, the control device that was originally in duty mode is selected.
[0048] However, the following technical problems exist in the related technologies: 1. If the data channel that becomes on duty later is later than the data channel that is currently on duty, the controlled device selects the data channel that is currently on duty, which violates the principle of "later master as master"; 2. Due to the inconsistency in data transmission between the two control devices, the current data cannot be sent according to the actually selected channel; 3. The scalability of the one master and one backup model is insufficient and cannot adapt to more complex business scenarios.
[0049] This disclosure provides a method for determining a master device, which can be executed by the processor of a computer device. The computer device refers to a device with data processing capabilities, such as a server, laptop, tablet, desktop computer, smart TV, set-top box, or mobile device (e.g., mobile phone, portable video player, personal digital assistant, dedicated messaging device, portable gaming device). Figure 1 As shown, the method includes the following steps 101 to 102:
[0050] Step 101: Based on the first control data received from at least one control device at the current time, determine whether the current time satisfies the triggering condition that indicates that only one control device is allowed to switch between primary and backup states at the same time.
[0051] The master device determination method provided in this disclosure can be applied to scenarios where multiple control devices act on a single controlled device. For example... Figure 2 As shown, the overall control system may include four control devices: control device A, control device B, control device C, and control device D. All four control devices can interact with the controlled devices.
[0052] "At least one control device" refers to one or more control devices. For example, "at least one control device" may refer to... Figure 2 The system contains at least one of the following four control devices: control device A, control device B, control device C, and control device D.
[0053] The first control data refers to control data received at least once from a control device at the current moment. Control data is used to instruct the controlled device to perform corresponding operations to achieve corresponding functions. Specifically, in the field of battery manufacturing technology, control data refers to instructions capable of monitoring and controlling the state of the Battery Management Controller (BMC). For example, control data can be a shutdown instruction to turn off the BMC, or a turn-on instruction to turn the BMC on.
[0054] Triggering conditions refer to pre-defined conditions used to trigger the primary / standby selection logic. In one feasible implementation, the triggering conditions can be determined by analyzing the interaction flow between the control device and the controlled device in the current business scenario. Specifically, by analyzing the interaction flow between the control device and the controlled device in the current business scenario, it is found that different control devices require different amounts of time to send data. Therefore, to ensure data consistency, a triggering condition is set that only one control device is allowed to switch between primary and standby states at any given time.
[0055] In one feasible implementation, step 101 can be implemented as follows: analyze the first control data received from at least one control device at the current time to determine whether only one control device is switching between primary and backup states at the current time; if only one control device is switching between primary and backup states at the current time, then the triggering condition is met at the current time; if two or more control devices are switching between primary and backup states at the current time, then the triggering condition is not met at the current time.
[0056] Step 102: If the triggering condition is met at the current time, select a master control device from the at least one control device based on the second control data received from the at least one control device within a first time period after the current time.
[0057] The control data from the main control device is used to enable the controlled device to perform the operation corresponding to the control data.
[0058] The first duration refers to the time required to wait for at least one control device to send control data after the triggering condition is met at the current moment.
[0059] In one feasible implementation, the first duration can be any duration. Alternatively, to ensure that control data sent by all control devices can be received, the first duration is determined based on the transmission duration of control data from at least one control device; it should be noted that within the first duration, control data sent by all control devices can be received.
[0060] For example, the first duration can be determined by the longest transmission duration required for at least one control device to send control data.
[0061] Another example is that the first duration can be determined based on the longest transmission duration and a time threshold. For example, the time threshold could be 1 microsecond (µs).
[0062] The second control data refers to control data received from at least one control device within a first time period after the current moment.
[0063] In one feasible implementation, step 102 can be implemented as follows: when the triggering condition is met at the current moment, a master / slave selection logic is adopted, and a master control device is selected from at least one control device based on the second control data of at least one control device.
[0064] For example, the primary / backup selection logic can be a logic where the last control device becomes the primary device. Specifically, the control device whose issuance time is the last can be used as the primary / backup selection logic, and this logic can be programmed into the computer device so that, when the triggering conditions are met, the primary / backup selection logic is automatically executed to select the primary control device from at least one control device.
[0065] Another example is that the primary / standby selection logic can be based on historical control data from at least one control device. Specifically, the most efficient control device is determined based on the historical control data of at least one control device, and this most efficient control device is selected as the primary control device.
[0066] As another example, the primary / standby selection logic can be random. Specifically, one control device is randomly selected from at least one control device as the primary control device.
[0067] It should be noted that the master device determination method provided in this disclosure can be applied to an intermediate device between the controlling device and the controlled device. In this case, the intermediate device is used as a computer device to execute the steps of the master device determination method provided in this disclosure. Alternatively, the master device determination method provided in this disclosure can be applied to the controlled device. In this case, the controlled device is used as a computer device to execute the steps of the master device determination method provided in this disclosure.
[0068] In this embodiment, by defining a trigger condition that allows only one control device to switch between primary and backup states at any given time, the timing of primary / backup selection is limited. This avoids abnormal triggering such as accidental touches, improving the effectiveness of primary / backup selection compared to related technologies where switching is easily triggered by accidental touches or other abnormal events. When the trigger condition is met, a primary control device is selected from at least one control device based on second control data received from at least one control device within a first time period after the current moment. This first time period ensures that control data from all control devices is currently available, thus the primary / backup selection is based on the control data from all control devices, reducing data consistency issues caused by inconsistent control device distribution times and improving data consistency. Furthermore, the primary device determination method provided in this embodiment can be applied to scenarios where two or more control devices act on one controlled device, offering a wider range of applications and greater scalability compared to related technologies that only apply to scenarios where two control devices act on one controlled device.
[0069] This disclosure provides a method for determining a master device, which can be executed by the processor of a computer device. For example... Figure 3 As shown, the method includes the following steps 301 to 304:
[0070] Step 301: Verify the content and validity of the first control data.
[0071] It should be noted that after receiving the first control data from at least one control device at the current moment, the first control data can be verified first. After the verification is successful, the first control data can be used to determine the timing of primary / backup selection.
[0072] In one feasible implementation, the same verification method can be used to verify the content and validity of the first control data; alternatively, different verification methods can be used to verify the content and validity of the first control data separately. In this way, adopting different verification methods for different aspects can improve the verification accuracy.
[0073] In some implementations, step 301 can be specifically implemented as follows: using a data transmission detection method to verify the first control data to determine whether there is any abnormality in the content of the first control data; matching the value of the switching identifier in the first control data with a preset identifier value to determine whether the first control data is valid.
[0074] The data transmission detection method is used to determine whether any abnormalities occur in the content of the first control data during transmission.
[0075] In one feasible implementation, the data detection method can be Cyclic Redundancy Check (CRC). In this case, the CRC check method is used to verify the first control data to determine if its content is abnormal. Alternatively, an anomaly detection algorithm can also be used to verify the first control data to determine if its content is abnormal; for example, the anomaly detection algorithm can be a digital signature algorithm or a parity check method.
[0076] Specifically, a CRC code is pre-processed using the calculation formula in the CRC check method to obtain a CRC code, which is then appended to the end of the first control data. Upon receiving the first control data, the same CRC check method is used to process the received first control data to obtain a CRC code, which is then compared with the CRC code at the end of the first control data. If the comparison is successful, it indicates that the content of the first control data is normal; if the comparison fails, it indicates that the content of the first control data is abnormal. In this case, a message indicating that the first control data is abnormal can be sent to the control device so that the first control data can be re-acquired.
[0077] The validity of the first control data is determined by the value of the switching identifier in the first control data. The switching identifier refers to an identifier at a specific location in the first control data, and the value of this identifier can indicate the primary / standby status of the corresponding control device.
[0078] Since the primary / standby status of the corresponding control device is determined by the switching identifier carried in the control data in this embodiment, the validity of the first control data can be determined based on the matching of the switching identifier value in the first control data with a preset identifier value.
[0079] In one feasible implementation, the preset identifier value refers to a pre-defined identifier value representing the primary / standby status. The preset identifier value may include a first identifier value representing the primary status (on-call status) and a second identifier value representing the standby status (off-call status). For example, the primary status (on-call status) can be represented by aa00, and the standby status (off-call status) can be represented by 5500.
[0080] Specifically, if the value of the switching identifier in the first control data is the same as any of the preset identifier values, the first control data is determined to be valid; if the value of the switching identifier in the first control data is different from any of the preset identifier values, the first control data is determined to be invalid.
[0081] Step 302: If the content of the first control data is not abnormal and the first control data is valid, determine whether the triggering condition is met at the current moment based on the first control data.
[0082] In one feasible implementation, the specific implementation of "determining whether the triggering condition is met at the current time based on the first control data" in step 302 can be as follows: determine the primary / backup status of at least one control device at the time of the last primary / backup selection; determine whether the triggering condition is met at the current time based on the value of the switching identifier in the first control data and the primary / backup status of at least one control device at the time of the last primary / backup selection.
[0083] Furthermore, in some implementations, the triggering condition includes at least one of the following three conditions:
[0084] Condition 1: Any control device switches from off-duty state to on-duty state;
[0085] Condition 2: Any control device switches from on-duty state to off-duty state, and none of the control devices switch from off-duty state to on-duty state;
[0086] Condition 3: The current selection result during the previous primary / backup selection is the same as the temporary selection result during the current primary / backup selection.
[0087] Condition 1 indicates that at least one control device switches from standby to master, meaning only one control device needs to switch to master mode at this time. Condition 2 indicates that only one control device switches from master to standby, and all other devices are in standby mode at this time. Condition 3 indicates that the currently selected master control device is the same as the previously selected master / standby device; in this case, master / standby selection logic can also be triggered.
[0088] In some implementations, the specific implementation of "determining whether the triggering condition is met at the current time based on the first control data" in step 302 can be as follows: Based on the value of the switching identifier in the first control data, determine whether any of the at least one control device switches from an off-duty state to an on-duty state at the current time; the off-duty state indicates that the corresponding control device is a backup control device, and the on-duty state indicates that the corresponding control device is a master control device; Based on the value of the switching identifier in the first control data, determine whether any of the at least one control device switches from an on-duty state to an off-duty state at the current time, and whether all control devices have not switched from an off-duty state to an on-duty state; If any of the at least one control device switches from an off-duty state to an on-duty state at the current time, or if any of the at least one control device switches from an on-duty state to an off-duty state at the current time, and all control devices have not switched from an off-duty state to an on-duty state, then determine that the triggering condition is met at the current time.
[0089] In one feasible implementation, the specific implementation of "determining whether any control device in at least one control device switches from off-duty state to on-duty state at the current time based on the value of the switching identifier in the first control data" can be as follows: if the value of the switching identifier in the first control data of any control device is a first identifier value, and the value of the switching identifier of this control device during the last primary / backup selection was a second identifier value, then it is determined that this control device switches from off-duty state to on-duty state.
[0090] In one feasible implementation, the specific implementation of "determining whether any of the at least one control devices has switched from on-duty to off-duty state at the current moment, based on the value of the switching identifier in the first control data, and all control devices have not switched from off-duty to on-duty state" can be as follows: If the value of the switching identifier in the first control data of any control device is the second identifier value, and the value of the switching identifier of this control device during the last primary / backup selection was the first identifier value, then it is determined that this control device has switched from on-duty to off-duty state; if the value of the switching identifier in the first control data of other control devices is the second identifier value, and the value of the switching identifier of other control devices during the last primary / backup selection was also the second identifier value, then it is determined that all control devices have not switched from off-duty to on-duty state; if both of the above conditions are met, it is determined that at the current moment, at least one of the control devices has switched from on-duty to off-duty state, and all control devices have not switched from off-duty to on-duty state.
[0091] If at least one of the control devices switches from an off-duty state to an on-duty state at the current moment, it indicates that condition 1 of the triggering conditions is met. If at least one of the control devices switches from an on-duty state to an off-duty state at the current moment, and none of the control devices switch from an off-duty state to an on-duty state, it indicates that condition 2 of the triggering conditions is met.
[0092] Here, steps 301 to 302 correspond to step 101 mentioned above, and can be implemented with reference to the specific implementation of step 101 mentioned above.
[0093] Step 303: If the triggering condition is met at the current moment, select one control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each second control data.
[0094] If the triggering conditions are met at the current moment, it means that the timing for the primary / backup selection logic is met, and primary / backup selection can be performed.
[0095] In one feasible implementation, the specific implementation of step 303, "selecting a control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each of the second control data", can be as follows: select a control device from the at least one control device as a temporary selection result according to the order of transmission time.
[0096] In some implementations, step 303 can be specifically implemented as follows: when the triggering condition is met at the current moment, the channel state machine is switched from an idle state to a waiting state; the channel state machine represents the progress of the current primary / backup selection; during the first duration of the channel state machine entering the waiting state, second control data sent by the at least one control device is received; the temporary selection result is updated based on the value of the switching identifier in the second control data according to the order of the sending time.
[0097] The channel state machine represents the progress of the current primary / standby selection. The states of the channel state machine can include idle state, waiting state, selection state, transmission state, and end state.
[0098] Before the primary / standby selection logic is triggered, the channel state machine is in the idle state (ST_IDLE); after the primary / standby selection logic is triggered, the channel state machine enters the waiting state (ST_WAIT); after the waiting time is reached, the channel state machine enters the selection state (ST_CHNL_SEL); after the primary control device is selected, the channel state machine enters the transmission state (ST_TRANS); after the transmission is completed, the channel state machine enters the completion state (ST_END).
[0099] The first duration is also used to determine when the channel state machine switches from the waiting state to the selection state.
[0100] It should be noted that during the first time period, the system receives second control data from all control devices regarding the switching of primary and backup states. In other words, during the first time period, all control devices are allowed to switch between primary and backup states.
[0101] The temporary selection result is updated in real time based on the switching identifier in the received second control data. For example, if second control data is received sequentially from control device A and control device B within the first time period, and the value of the switching identifier in the second control data is the first identifier value, then the temporary selection result is updated to control device A after receiving the second control data from control device A, and updated to control device B after receiving the second control data from control device B.
[0102] Step 304: Determine the current selection result based on the temporary selection result, and take the control device corresponding to the current selection result as the currently selected main control device.
[0103] In some implementations, step 304 can be implemented as follows: after the channel state machine enters the waiting state for a first duration, the channel state machine is switched from the waiting state to the selection state; when the channel state machine enters the selection state, the temporary selection result is taken as the current selection result, and the control device corresponding to the current selection result is taken as the main control device.
[0104] In one feasible implementation, to ensure the timeliness of control, the control device whose switching identifier value is the first identifier value in the last received second control data within the first time period is taken as a temporary selection result and latched. The latched temporary selection result is taken as the current selection result, and the control device corresponding to the current selection result is taken as the main control device.
[0105] It should be noted that if the current latched temporary selection result is the same as the current selection result during the previous primary / backup selection, it is determined that condition 3 in the triggering conditions is met at the current moment, so as to execute the primary / backup selection logic (steps 303 to 304).
[0106] Here, steps 303 to 304 correspond to step 102 above, and can be implemented with reference to the specific implementation of step 102 above.
[0107] In some embodiments, the master device determination method provided in this disclosure may further include the following steps 305 to 308:
[0108] Step 305: After determining the main control device, switch the channel state machine from the selection state to the transmission state.
[0109] Step 306: When the channel state machine enters the transmission state, transmit the control data to the target location.
[0110] Step 307: After the control data transmission is completed, switch the channel state machine from the transmission state to the end state.
[0111] Step 308: After the channel state machine is in the end state, switch the channel state machine from the end state to the idle state.
[0112] It should be noted that, in order to ensure that the control data of the master control device has been received by the controlled device, the channel state machine can be switched from the end state to the idle state after the second duration of the channel state machine being in the end state.
[0113] The second duration is determined based on the time required for the controlled device to receive any control data, ensuring that the next waiting state is entered only after the control data is sent out, triggering the next round of primary / backup selection logic.
[0114] In one feasible implementation, the second duration can be determined based on the time required for the controlled device to receive any control data. Specifically, a third duration required for the controlled device to receive any control data can be determined; the second duration is then determined based on the third duration. Specifically, determining the second duration based on the third duration can be achieved by using the longest possible third duration as the second duration; or by determining the first duration based on the third duration and a preset time threshold. For example, the time threshold could be 1 microsecond (µs).
[0115] In this embodiment, by defining a trigger condition that allows only one control device to switch between primary and backup states at any given time, the timing of primary / backup selection is limited. This avoids abnormal triggering such as accidental touches, improving the effectiveness of primary / backup selection compared to related technologies where switching is easily triggered by accidental touches or other abnormal events. When the trigger condition is met, a primary control device is selected from at least one control device based on second control data received from at least one control device within a first time period after the current moment. This first time period ensures that control data from all control devices is currently available, thus the primary / backup selection is based on the control data from all control devices, reducing data consistency issues caused by inconsistent control device distribution times and improving data consistency. Furthermore, the primary device determination method provided in this embodiment can be applied to scenarios where two or more control devices act on one controlled device, offering a wider range of applications and greater scalability compared to related technologies that only apply to scenarios where two control devices act on one controlled device.
[0116] The following describes the application of the master device determination method provided in the embodiments of this disclosure in a real-world scenario.
[0117] like Figure 4 As shown, the controlled device is simultaneously connected to four control devices: control device A, control device B, control device C, and control device D. Control device A sends control data A, control device B sends control data B, control device C sends control data A, and control device D sends control data D. After selecting a master control device from these four devices through master / slave selection logic, feedback data can be sent to control devices A, B, C, and D respectively to inform them of the master / slave selection result, facilitating comprehensive control of the overall control system. Any control device and the controlled device can exchange data using the Generic Attribute Profile (GATT) protocol.
[0118] Specifically, the controlled device can receive control data from four control devices: Control Device A, Control Device B, Control Device C, and Control Device D. If a specific position in any control data is 'aa00', it indicates that the corresponding control device is in an on-duty state; if a specific position in any control data is '5500', it indicates that the corresponding control device is in an off-duty state. In normal operating mode, only one control device is in an on-duty state, and the controlled device selects the control data sent by the primary control device.
[0119] like Figure 5 As shown, the specific process of the master device determination method provided in this embodiment may include the following steps 501 to 511:
[0120] Step 501: When the channel state machine is in the waiting state, receive the first control data sent by the four control devices: control device A, control device B, control device C and control device D.
[0121] Step 502: Verify the control data.
[0122] Specifically, the content and validity of the control data are validated. If the validation is successful, proceed to step 503; if the validation fails, return to step 501.
[0123] Step 503: Determine whether the triggering condition is met at the current moment based on the first control data.
[0124] The triggering condition includes one of the following three conditions:
[0125] 1. Switch any one of the four control devices, namely control device A, control device B, control device C, and control device D, from off-duty status to on-duty status;
[0126] 2. Any one of the four control devices, namely control device A, control device B, control device C, and control device D, switches from on-duty state to off-duty state, and no other channel switches from off-duty state to on-duty state.
[0127] 3. The current temporary selection result of the primary / backup selection is the same as the current selection result during the previous primary / backup selection.
[0128] If the triggering condition is met at the current moment, proceed to step 504; if the triggering condition is not met at the current moment, re-execute step 501.
[0129] Step 504: Switch the channel state machine from the idle state to the waiting state.
[0130] After the primary / standby selection logic is triggered, the channel state machine enters a waiting state, with a configurable waiting time Td (first duration). During the waiting time, it receives the duty status changes of all control devices and records and updates the results of the temporary selection.
[0131] Step 505: Determine whether the time for the channel state machine to enter the waiting state has reached the first duration.
[0132] If the channel state machine enters the waiting state for a period of time equal to the first duration, then proceed to step 506; if the channel state machine enters the waiting state for a period of time equal to the first duration, then proceed to step 505.
[0133] Step 506: Switch the channel state machine from the waiting state to the selection state.
[0134] After a waiting time Td, the channel state machine enters the selection state, and the current selection result is latched and stored as the selection value of the temporary selection result.
[0135] Step 507: Determine if the current selection result is 0.
[0136] The overall control system includes four control devices: control device A, control device B, control device C, and control device D. The current selection result has five possible outcomes: 0, indicating no main control device has been selected; 1, indicating control device A is selected as the main control device; 2, indicating control device A is selected as the main control device; 3, indicating control device C is selected as the main control device; 4, indicating control device C is selected as the main control device; 5, indicating control device D is selected as the main control device.
[0137] It should be noted that the temporary selection result is used to monitor the duty status of four control devices: Control Device A, Control Device B, Control Device C, and Control Device D, and is updated synchronously. The current selection result is only updated and retained after the first duration ends. Both the temporary and current selection results work together in the primary / backup selection logic. When the channel state machine switches from the waiting state to the selection state, the current selection result receives the selection value from the temporary selection result and retains it.
[0138] If the current selection result is 0, then repeat step 501; if the current selection result is not 0, then repeat step 508.
[0139] Step 508: Select the control device corresponding to the current selection result as the main control device, and switch the channel state machine from the selection state to the transmission state.
[0140] Step 509: When the channel state machine enters the transmission state, send control data from the main control device.
[0141] Step 510: After the control data transmission of the main control device is completed, switch the channel state machine from the transmission state to the end state.
[0142] Step 511: Determine whether the time it takes for the channel state machine to enter the end state exceeds the second duration.
[0143] The second duration can be 3µs. If the channel state machine takes longer than the second duration to enter the end state, then the channel state machine is switched from the end state to the idle state; if the channel state machine takes less than the second duration to enter the end state, then step 510 is executed.
[0144] The switching of control equipment from on-duty state to off-duty state and from off-duty state to on-duty state are mutually exclusive. That is, only the switching flag of one control device is allowed to be valid at any given time. When the switching flag of another control device becomes valid in the next moment, the old switching flag from the previous moment will be cleared. These switching flags affect the selection value of the temporary selection result under the same on-duty or off-duty conditions.
[0145] After selection, wait 3µs for the channel state machine to enter the waiting state, ensuring that the control data from the main control device is sent before entering the next waiting state.
[0146] If a control device switches from off-duty to on-duty status, but before the waiting time Td arrives, the current cycle will still send data according to the current selection result when the primary / backup was selected last time, and the next cycle will switch to the new control device.
[0147] like Figure 6 As shown, at time T0, the switching flag of control device A changes from 0 (off-duty state) to 1 (on-duty state), while the switching flags of control devices B, C, and D remain at 0. At this time, the temporary selection result is 1 (control device A). At time T1, the switching flag of control device D changes from 0 to 1, and the temporary selection result is 4. After time Td, the temporary selection result is 4, and the current selection result is 4. At this time, control device D is selected as the main control device for data transmission.
[0148] like Figure 7 As shown, in the current cycle, the state machine is not started at time T1, and control device A is still selected for data transmission. After the state machine is started at time T2, the selected value of the temporary result is still 4. Therefore, after time T2+Td arrives, control device D is selected as the main control device for data transmission.
[0149] It should be noted that the embodiments disclosed herein include at least the following innovative points:
[0150] 1. The number of control devices has been expanded from two to more than two (e.g., Figure 2 The system includes control devices A, B, C, and D. A waiting time is set to allow all control devices to switch between primary and backup states.
[0151] 2. The primary / backup selection is split into temporary selection results and current selection results. The temporary selection results are responsible for monitoring the duty status of at least one control device throughout the process and updating it synchronously. The current selection results are only updated and maintained at the end of the waiting time. The temporary selection results and the current selection results work together to affect the primary / backup selection logic.
[0152] 3. The switching of control equipment from on-duty state to off-duty state and from off-duty state to on-duty state are mutually exclusive. That is, only the switching flag of one control equipment is allowed to be valid at the same time. When the switching flag of other control equipment becomes valid in the next moment, it replaces the old switching flag and remains valid.
[0153] 4. Valid control data received from control equipment does not necessarily trigger the primary / standby selection logic. Certain conditions (triggering conditions) must also be met to avoid triggering the primary / standby selection logic with off-duty data, which would affect data consistency.
[0154] Based on the foregoing embodiments, this disclosure provides a master device determination apparatus, which includes various units and modules included in each unit, and can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0155] Figure 8 This is a schematic diagram of the composition structure of a master device determining device provided in an embodiment of this disclosure, as shown below. Figure 8 As shown, the main device determining device 800 includes: a determining module 810 and a selecting module 820, wherein:
[0156] The determination module 810 is configured to determine whether the current time satisfies the trigger condition that indicates that only one control device is allowed to switch between primary and backup states at the same time, based on the first control data received from at least one control device at the current time.
[0157] The selection module 820 is configured to select a master control device from the at least one control device based on the second control data received from the at least one control device within a first time period after the current time, when the triggering condition is met at the current time.
[0158] In some embodiments, the determining module 810 is specifically configured to: verify the content and validity of the first control data; and, if the content of the first control data is not abnormal and the first control data is valid, determine whether the triggering condition is met at the current time based on the first control data.
[0159] In some embodiments, the determining module 810 is specifically configured to: use a data transmission detection method to verify the first control data to determine whether the content of the first control data is abnormal; match the value of the switching identifier in the first control data with a preset identifier value to determine whether the first control data is valid.
[0160] In some embodiments, the determining module 810 is specifically configured to: determine, based on the value of the switching identifier in the first control data, whether any of the at least one control device switches from an off-duty state to an on-duty state at the current time; the off-duty state indicates that the corresponding control device is a backup control device, and the on-duty state indicates that the corresponding control device is a master control device; based on the value of the switching identifier in the first control data, determine whether any of the at least one control device switches from an on-duty state to an off-duty state at the current time, and whether all control devices have not switched from an off-duty state to an on-duty state; if any of the at least one control device switches from an off-duty state to an on-duty state at the current time, or if any of the at least one control device switches from an on-duty state to an off-duty state at the current time, and all control devices have not switched from an off-duty state to an on-duty state, determine that the triggering condition is met at the current time.
[0161] In some embodiments, the selection module 820 is specifically configured to: when the triggering condition is met at the current time, select a control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each of the second control data; determine the current selection result based on the temporary selection result, and take the control device corresponding to the current selection result as the currently selected main control device.
[0162] In some embodiments, the selection module 820 is specifically configured to: switch the channel state machine from an idle state to a waiting state when the triggering condition is met at the current moment; the channel state machine represents the progress of the current primary / backup selection; during the first duration of the channel state machine entering the waiting state, receive second control data sent by the at least one control device; and update the temporary selection result based on the value of the switching identifier in the second control data according to the order of the sending time.
[0163] In some embodiments, the selection module 820 is specifically configured to: after the channel state machine enters the waiting state for a first duration, switch the channel state machine from the waiting state to the selection state; when the channel state machine enters the selection state, take the temporary selection result as the current selection result, and take the control device corresponding to the current selection result as the main control device.
[0164] In some embodiments, the determining module 810 is specifically configured to: after determining the main control device, switch the channel state machine from the selected state to the transmission state; when the channel state machine enters the transmission state, transmit the control data of the main control device to the target location; after the control data transmission of the main control device is completed, switch the channel state machine from the transmission state to the end state; after the channel state machine is in the end state, switch the channel state machine from the end state to the idle state.
[0165] In some embodiments, the determining module 810 is specifically configured to: determine that the triggering condition is met at the current moment when the current selection result during the previous primary / backup selection is the same as the temporary selection result during the current primary / backup selection.
[0166] In some embodiments, the triggering conditions include at least one of the following: any control device switches from an off-duty state to an on-duty state; any control device switches from an on-duty state to an off-duty state, and none of the control devices switch from an off-duty state to an on-duty state; the current selection result during the last primary / backup selection is the same as the temporary selection result during the current primary / backup selection.
[0167] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this disclosure can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.
[0168] It should be noted that, in the embodiments of this disclosure, if the above-described main device determination method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this disclosure, or the part that contributes to related technologies, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this disclosure are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.
[0169] This disclosure provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.
[0170] This disclosure provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium may be transient or non-transient.
[0171] This disclosure provides a computer program including computer-readable code, wherein when the computer-readable code is executed in a computer device, a processor in the computer device performs some or all of the steps in the above-described method.
[0172] This disclosure provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.
[0173] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referenced interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.
[0174] It should be noted that, Figure 9 This is a schematic diagram of a hardware entity of a computer device in an embodiment of this disclosure, such as... Figure 9 As shown, the hardware entity of the computer device 900 includes: a processor 901, a communication interface 902, and a memory 903, wherein:
[0175] Processor 901 typically controls the overall operation of computer device 900.
[0176] Communication interface 902 enables computer devices to communicate with other terminals or servers over a network.
[0177] The memory 903 is configured to store instructions and applications executable by the processor 901, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 901 and various modules in the computer device 900. It can be implemented using flash memory or random access memory (RAM). Data transfer between the processor 901, the communication interface 902, and the memory 903 can be performed via bus 904.
[0178] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this disclosure. Therefore, "in one embodiment" or "one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this disclosure, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure. The sequence numbers of the above embodiments of this disclosure are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0179] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0180] In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0181] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0182] In addition, each functional unit in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0183] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0184] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.
[0185] The above description is merely an embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for determining a master device, characterized in that, The method for determining the master device includes: Based on the first control data received from at least one control device at the current moment, determine whether the current moment meets the triggering condition that indicates that only one control device is allowed to switch between primary and backup states at the same time. If the triggering condition is met at the current moment, a master control device is selected from the at least one control device based on the second control data received from the at least one control device within a first time period after the current moment.
2. The method for determining the main equipment according to claim 1, characterized in that, The determination of whether the current time satisfies the triggering condition characterizing that only one control device is allowed to switch between primary and backup states at the same time, based on the first control data received from at least one control device at the current time, includes: The content and validity of the first control data are verified. If the content of the first control data is not abnormal and the first control data is valid, determine whether the triggering condition is met at the current moment based on the first control data.
3. The method for determining the main equipment according to claim 2, characterized in that, The verification of the content and validity of the first control data includes: The first control data is verified using a data transmission detection method to determine whether there are any abnormalities in the content of the first control data; The value of the switching identifier in the first control data is matched with a preset identifier value to determine whether the first control data is valid.
4. The method for determining the main equipment according to any one of claims 1 to 3, characterized in that, The determination of whether the current time satisfies the triggering condition characterizing that only one control device is allowed to switch between primary and backup states at the same time, based on the first control data received from at least one control device at the current time, includes: Based on the value of the switching identifier in the first control data, it is determined whether any of the at least one control device switches from an off-duty state to an on-duty state at the current moment; the off-duty state indicates that the corresponding control device is a backup control device, and the on-duty state indicates that the corresponding control device is a master control device; Based on the value of the switching identifier in the first control data, it is determined whether at the current moment any of the at least one control device has switched from the on-duty state to the off-duty state, and whether all control devices have switched from the off-duty state to the on-duty state. If at the current moment any one of the at least one control devices switches from off-duty to on-duty state, or if at the current moment any one of the at least one control device switches from on-duty to off-duty state and none of the control devices switch from off-duty to on-duty state, then the triggering condition is determined to be met at the current moment.
5. The method for determining the main equipment according to any one of claims 1 to 3, characterized in that, When the triggering condition is met at the current moment, selecting a master control device from the at least one control device based on the second control data received from the at least one control device within a first time period after the current moment includes: If the triggering condition is met at the current moment, based on the second control data and the transmission time of each of the second control data, one control device is selected from the at least one control device as a temporary selection result. The current selection result is determined based on the temporary selection result, and the control device corresponding to the current selection result is taken as the current selected main control device.
6. The method for determining the main equipment according to claim 5, characterized in that, When the triggering condition is met at the current moment, selecting a control device from the at least one control device as a temporary selection result based on the second control data and the transmission time of each piece of the second control data includes: If the triggering condition is met at the current moment, the channel state machine will switch from the idle state to the waiting state; the channel state machine represents the progress of the current primary / backup selection. During the first duration of the channel state machine entering the waiting state, the second control data sent by the at least one control device is received; The temporary selection result is updated based on the value of the switching identifier in the second control data, according to the order of the transmission time.
7. The method for determining the main equipment according to claim 6, characterized in that, The step of determining the current selection result based on the temporary selection result, and designating the control device corresponding to the current selection result as the currently selected main control device, includes: After the channel state machine has been in the waiting state for a first duration, the channel state machine is switched from the waiting state to the selection state. When the channel state machine enters the selection state, the temporary selection result is taken as the current selection result, and the control device corresponding to the current selection result is taken as the main control device.
8. The method for determining the main equipment according to claim 7, characterized in that, The method for determining the master device also includes: After the main control device is determined, the channel state machine is switched from the selection state to the transmission state; When the channel state machine enters the transmission state, it transmits the control data of the main control device to the target location; After the control data transmission of the main control device is completed, the channel state machine is switched from the transmission state to the end state; After the channel state machine is in the end state, the channel state machine is switched from the end state to the idle state.
9. The method for determining the main equipment according to claim 5, characterized in that, The method for determining the master device also includes: If the current selection result during the previous primary / backup selection is the same as the temporary selection result during the current primary / backup selection, it is determined that the triggering condition is met at the current moment.
10. The method for determining the main equipment according to any one of claims 1 to 3, or 6 to 9, characterized in that, The triggering condition includes at least one of the following: Any control device switches from off-duty to on-duty status; Any control device switches from on-duty state to off-duty state, and none of the control devices switch from off-duty state to on-duty state; The current selection result during the last primary / backup selection is the same as the temporary selection result during the current primary / backup selection.
11. A master equipment determining device, characterized in that, The main equipment determining device includes: The determination module is configured to determine whether the current time satisfies the triggering condition that indicates that only one control device is allowed to switch between primary and backup states at the same time, based on the first control data received from at least one control device at the current time. The selection module is configured to select a master control device from the at least one control device based on the second control data received from the at least one control device within a first time period after the current time, when the triggering condition is met at the current time.
12. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 10.
14. A computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein when the computer program is read and executed by a computer, it implements the steps of the method according to any one of claims 1 to 10.