A multi-terminal access scheduling method, apparatus, device and medium

By allocating target logical channels in the logical channel table and adopting single-connection pipeline and slot-based management, the problem of disordered access of multiple low-power terminals is solved, achieving orderly access and no crosstalk of instructions, thus improving connection reliability and terminal inventory efficiency.

CN123145667APending Publication Date: 2026-11-20广州莲雾科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611493514.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-23
Publication Date
2026-11-20

Smart Images

  • Figure CN123145667A_ABST
    Figure CN123145667A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of multi-terminal access scheduling method, device, equipment and medium.The multi-terminal access scheduling method described in the present application includes: obtaining control instruction for target terminal, and in the preset logical channel table, corresponding target logical channel is allocated for target terminal;When the broadcast signal of target terminal is scanned, stop scanning, and initiate physical connection to target terminal;In response to establishing physical connection, control instruction is issued to target terminal;Control instruction is used to indicate target terminal to execute corresponding task and feedback corresponding execution result;In response to the process of connection establishment or the process of executing control instruction triggers preset timeout condition or failure condition, corresponding processing action is executed based on preset exception handling strategy, and corresponding state feedback information is generated.The multi-terminal access scheduling method described in the present application has the advantages of orderly access and instruction without crosstalk for batch terminals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of short-range wireless communication, and in particular relates to a multi-terminal access scheduling method, apparatus, device and medium. Background Technology

[0002] Low-power electronic terminals (such as employee ID cards, asset tags, battery box controllers, etc.) are typically battery-powered and require a battery life of several months or even years. Therefore, they generally adopt a duty cycle working mode of "deep sleep + periodic wake-up broadcast + accepting gateway (AP / access point) connection and interaction + sleeping again". In batch deployment scenarios (such as hundreds or thousands of terminals in a workshop / building), the AP needs to continuously scan, discover and connect to a large number of periodically woken terminals, and reliably issue commands and collect execution results.

[0003] Existing technologies have the following drawbacks: unordered concurrent access from multiple terminals and easy crosstalk of instructions. Continuous scanning by the AP will simultaneously detect broadcasts from multiple terminals. If connection establishment and data transmission are carried out concurrently without scheduling, the connection establishment, parameter negotiation, and data exchange at the same time will interfere with each other; multiple pending instructions for the same terminal may be written into the same channel and overwrite each other. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, device, and medium for scheduling multi-terminal access that enables orderly access of a batch of terminals by an AP and free instruction crosstalk, in order to address the aforementioned technical problems.

[0005] Firstly, this application provides a multi-terminal access scheduling method, including: Obtain control commands for the target terminal and assign the corresponding target logical channel to the target terminal in the preset logical channel table; When a broadcast signal from the target terminal is detected, the scanning stops and a physical connection is initiated to the target terminal. In response to establishing a physical connection, control commands are sent to the target terminal; the control commands are used to instruct the target terminal to perform corresponding tasks and provide feedback on the corresponding execution results. In response to preset timeout or failure conditions triggered during connection establishment or control command execution, corresponding processing actions are executed based on preset exception handling strategies, and corresponding status feedback information is generated.

[0006] In one embodiment, the method further includes: When a broadcast signal from a target terminal is detected, the global connection status flag is set and the scanning stops. In response to establishing a physical connection, a parameter negotiation process is performed with the target terminal, and after the parameter negotiation is completed, the parameter update ready flag corresponding to the target terminal is recorded in the logical channel table. The sending and receiving of control commands is triggered based on the parameter update ready flag, and the parameter update ready flag is cleared after the sending and receiving are completed. After disconnecting the physical connection with the target terminal, clear the global connection status flags and restart the scan.

[0007] In one embodiment, in response to a preset timeout or failure condition being triggered during connection establishment or execution of control commands, a corresponding processing action is executed based on a preset exception handling strategy, and status feedback information containing a failure reason identifier is generated, including: If a physical connection is not successfully established within a preset connection timeout threshold after initiation, the physical connection is cancelled and retry counts are performed independently for each logical channel. In response to the retry count reaching the preset retry limit, the logical channel is cleaned up, and a status feedback message containing a connection failure identifier is generated.

[0008] In one embodiment, allocating a logical channel for the target terminal in the maintained logical channel table includes: If the target terminal has already occupied the first logical channel in the logical channel table, the first logical channel will be used as the target logical channel, and the control command will be written into the pending buffer of the first logical channel. If the target terminal does not occupy a logical channel in the logical channel table, and there is an idle logical channel in the logical channel table, select the second logical channel as the target logical channel from among the idle logical channels; If there is no free logical channel in the logical channel table, the control command is added to the pending queue, and the allocation of logical channels is retried according to the preset period.

[0009] In one embodiment, the method further includes: If the pending queue is full, refuse to accept new control commands and generate a status feedback message containing a system busy indicator; If the waiting time of a control command in the suspend queue exceeds the preset suspend timeout threshold, the control command will be removed from the suspend queue, and a status feedback message containing a processing timeout flag will be generated.

[0010] In one embodiment, the method further includes: During the scanning phase, historical execution results are extracted from the broadcast signals of the target terminal; The characteristic fields of the control instructions are compared with the historical execution results to obtain the comparison results; If the comparison results are consistent, the control command is determined to be a duplicate command, the step of initiating a physical connection is skipped, and status feedback information containing a duplicate indication is generated.

[0011] In one embodiment, the characteristic fields of the control instruction are compared with historical execution results to obtain the comparison result, including: Extract the instruction identifier and command word from the control instructions as feature fields; The feature field is compared byte by byte with the corresponding result field in the historical execution results. If the feature field and the result field are completely consistent, the comparison result is considered consistent. The comparison result is used to indicate that the target terminal has executed control instructions.

[0012] Secondly, this application also provides a multi-terminal access scheduling device, comprising: The allocation module is used to acquire control commands for the target terminal and allocate the corresponding target logical channel to the target terminal in a preset logical channel table. The connection establishment module is used to stop scanning and initiate a physical connection to the target terminal when a broadcast signal from the target terminal is detected. The sending module is used to send control commands to the target terminal in response to the establishment of a physical connection; the control commands are used to instruct the target terminal to perform corresponding tasks and to provide feedback on the corresponding execution results. The processing module is used to respond to preset timeout or failure conditions triggered during the connection establishment process or the execution of control commands, perform corresponding processing actions based on preset exception handling strategies, and generate corresponding status feedback information.

[0013] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect of this application.

[0014] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect of this application.

[0015] The aforementioned multi-terminal access scheduling method, apparatus, device, and medium acquire control commands for target terminals and allocate corresponding target logical channels for target terminals in a preset logical channel table; when a broadcast signal from a target terminal is detected, scanning stops and a physical connection is initiated to the target terminal; in response to establishing a physical connection, control commands are sent to the target terminal; the control commands instruct the target terminal to perform corresponding tasks and provide feedback on the corresponding execution results; in response to preset timeout or failure conditions being triggered during connection establishment or execution of control commands, corresponding processing actions are performed based on a preset exception handling strategy, and corresponding status feedback information is generated, thereby achieving the beneficial effects of orderly access for batch terminals and no crosstalk in commands. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a multi-terminal access scheduling method provided in this application; Figure 2 This is a schematic diagram of the structure of a multi-terminal access scheduling device provided in this application. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0019] It should be understood that the described embodiments are merely some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of the embodiments of this application.

[0020] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the embodiments of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0021] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0022] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0023] The multi-terminal access scheduling method provided in this application embodiment can be applied to the SparkLink AP (Access Point) as described below. The SparkLink AP can connect to a cloud platform (hereinafter referred to as the platform, which can be implemented using a separate server or a server cluster composed of multiple servers) and communicate with multiple SparkLink terminals. The relationship between the SparkLink terminal, the SparkLink AP, and the cloud platform is as follows: the platform issues instructions via the SparkLink AP using MQTT (Message Queuing Telemetry Transport), and the AP forwards the requests to the SparkLink terminal via SLE (SparkLink Low Energy) scanning / connection establishment / SSAP (SparkLink Service Access Protocol) write requests; after execution, the SparkLink terminal returns the results via the SLE notification / indication channel, and the AP reports to the platform.

[0024] The StarShine Terminal (BS21E, SLE Server) consists of an SLE communication module, a main control MCU (Micro-Controller Unit), non-volatile memory (NV), power-gated GPIO (General Purpose Input / Output) ports, and a controlled module (such as the SIM218 communication module). The StarShine Terminal may also be referred to below as a tag, electronic tag, tag terminal, terminal, or electronic terminal. The StarShine AP consists of three parts: a WAPI (WLAN Authentication and Privacy Infrastructure) module, a main control MCU, and a StarShine client. The WAPI module provides MQTT capabilities and securely accesses the WAN via WAPI. The main control MCU is responsible for the MQTT protocol state machine, JSON command parsing, command queue, on-board serial port frame protocol, and StarShine module power gating. The main control MCU of the StarShine AP can also be called the main control unit. The StarShine client (on-board BS21E chip, SLE Client) is responsible for slot-based multi-connection management, scanning / connection establishment / SSAP transmission and reception, MAC topology table, and pending queue. The main control MCU and the StarShine client are interconnected via the on-board serial port (UART 115200, custom frame protocol).

[0025] In one exemplary embodiment, such as Figure 1 As shown, a multi-terminal access scheduling method is provided. Taking the application of this method to the aforementioned StarSpark AP as an example, the method includes the following steps 102 to 108. Wherein: Step 102: Obtain control instructions for the target terminal and allocate the corresponding target logical channel to the target terminal in the preset logical channel table.

[0026] The target terminal can be a StarSpark terminal or a StarSpark terminal communicating with the StarSpark AP. This application uses a StarSpark terminal as the target terminal for illustration, but it is understood that the target terminal can be a terminal used in various other wireless communications, not limited to StarSpark terminals. Control commands can be generated by the StarSpark AP or sent from the cloud platform to the StarSpark AP via a wide area network. The logical channel table can be a table within the StarSpark AP used to record relevant data information of the communicating StarSpark terminals, also known as a slot table. The slot table can record multiple StarSpark terminals, as well as the terminal address, occupancy flag, connection status, connection handle, service and attribute discovery results, parameter update ready flag, and pending transmission / reception buffer pointers for each StarSpark terminal. Each StarSpark terminal corresponds to one logical channel, and the logical channel corresponding to the target terminal is the target logical channel.

[0027] For example, the StarScan AP obtains control commands for the target terminal and allocates a corresponding target logical channel for the target terminal in a preset logical channel table to record various communication data information corresponding to the target terminal.

[0028] Step 104: When a broadcast signal from the target terminal is detected, stop scanning and initiate a physical connection to the target terminal.

[0029] For example, the StarScan AP can be configured to a scan-always-on mode, continuously scanning when idle to discover terminal broadcasts / broadcast signals from nearby StarScan terminals. Upon detecting a broadcast signal from a target terminal, scanning stops, and a physical connection is initiated to the target terminal. The physical connection can also be simply referred to as a connection.

[0030] Among them, the StarShine AP maintains only one physical connection with the target terminal at any given time and does not initiate physical connections to other terminals to avoid mutual interference from concurrent connection establishment.

[0031] Step 106: In response to establishing a physical connection, a control command is sent to the target terminal; the control command is used to instruct the target terminal to perform the corresponding task and provide feedback on the corresponding execution result.

[0032] Optionally, the main control unit of the StarShine AP can encapsulate the control commands into serial interface frames according to a preset frame protocol and send them to the StarShine communication module. After the connection is established and service and attribute discovery is completed, the StarShine communication module sends the commands to the terminal via the StarShine SLE write request and receives the execution results returned by the terminal through the notification / instruction channel.

[0033] Step 108: In response to the triggering of preset timeout or failure conditions during the connection establishment process or the execution of control commands, execute the corresponding processing actions based on the preset exception handling strategy and generate corresponding status feedback information.

[0034] Specifically, the main control unit of the StarSpark AP sets layered timeouts for connection establishment, command sending, and command execution, corresponding to different timeout or failure conditions. When a timeout or failure occurs, at least one of the following is executed: connection cancellation, slot cleanup, and retry. An error code corresponding to the reason for failure is sent back to the main control unit, which then reports it to the platform.

[0035] In the aforementioned multi-terminal access scheduling method, addressing the lack of an access scheduling mechanism based on "slot-based channel management + single-connection pipeline" in existing technologies, the method acquires control commands for target terminals and allocates corresponding target logical channels to them in a preset logical channel table. Upon detecting a broadcast signal from a target terminal, scanning stops, and a physical connection is initiated. In response to establishing the physical connection, control commands are sent to the target terminal. These commands instruct the target terminal to execute corresponding tasks and provide feedback on the execution results. In response to preset timeout or failure conditions being triggered during connection establishment or control command execution, corresponding processing actions are performed based on a preset exception handling strategy, and corresponding status feedback information is generated. This method achieves the beneficial effects of orderly access for batches of terminals and no crosstalk in commands.

[0036] In one embodiment, the method further includes: Step 202: When a broadcast signal from the target terminal is detected, set the global connection status flag and stop scanning; Step 204: In response to establishing a physical connection, perform a parameter negotiation process with the target terminal, and record the parameter update ready flag corresponding to the target terminal in the logical channel table after the parameter negotiation is completed; Step 206: Trigger the sending and receiving of control commands based on the parameter update ready flag, and clear the parameter update ready flag after the sending and receiving are completed; Step 208: After disconnecting the physical connection with the target terminal, clear the global connection status flag and restart the scan.

[0037] The global connection status flag is used to characterize the current connection status of the StarSpark AP. When a StarSpark AP establishes a connection with any StarSpark terminal, the global connection status flag, also known as the global "connecting" flag, is set. When the global connection status flag is present, the StarSpark AP will not continue scanning and will not establish connections with other StarSpark terminals to avoid signal interference. Specifically, after the scan callback detects that a slot is occupied and a target terminal with pending commands is broadcasting, the global "connecting" flag is set, scanning stops, and a connection is immediately initiated—only one connection is maintained at a time, and scanning is restarted uniformly after a successful, failed, or disconnected connection.

[0038] For target terminals with established connections, the StarSpark AP will perform a parameter negotiation process with the target terminal and record the corresponding parameter update ready flag in the logical channel table after the parameter negotiation is completed. Specifically, after the connection is established, pairing, SSAP client registration and information exchange, and service and attribute discovery are completed in sequence to obtain writable attribute handles. Then, a connection parameter update is initiated (connection interval 0x20, supervisory timeout 0x1F4), and the parameter update ready flag is set. The client task clears the flag immediately after completing the read and write operation driven by the flag bit.

[0039] Furthermore, once the control commands between the StarScan AP and the target terminal are executed, the physical connection with the target terminal will be disconnected, the global connection status flag will be cleared, and the scan will be restarted.

[0040] Existing technologies suffer from the following problems: no closed loop for connection establishment failures / timeouts, and the platform is unaware of the command results. The terminal wake-up window is short (sub-second), and by the time the AP scans the terminal and initiates connection establishment, the terminal may have already gone back to sleep, making connection establishment prone to timeouts or failures. Existing technologies typically discard failed commands directly or blindly retransmit them, preventing the platform from obtaining a clear reason for the failure (connection failure, timeout, terminal not present, system busy, etc.), forcing repeated retransmissions and exacerbating air interface congestion.

[0041] To address the aforementioned technical problems, in one embodiment, in response to a preset timeout or failure condition being triggered during connection establishment or execution of control commands, a corresponding processing action is executed based on a preset exception handling strategy, and status feedback information containing a failure reason identifier is generated, including: Step 302: In response to the failure to establish a physical connection within the preset connection timeout threshold after initiating the physical connection, cancel the current physical connection and count the retry attempts independently for each logical channel. Step 304: In response to the retry count reaching the preset retry limit, the logical channel is cleaned up and a status feedback message containing a connection failure identifier is generated.

[0042] For example, if a connection is not established within 4 seconds after initiation, the connection is canceled and retried independently by slot, with a maximum of 2 retries. After all retries are exhausted, the slots are cleared, a connection failure error code is sent back, and the scan is restarted. If an instruction in the suspend queue is not sent within a preset time, it is dequeued and a processing timeout error code is sent back. Errors at each stage are sent back to the main controller in a frame of "terminal address + original instruction + error code". The error code system is as follows: 0x00 Success, 0x01 Execution Failure, 0x02 Connection Failure, 0x03 Terminal Not Found, 0x04 Processing Timeout, 0x05 System Busy, and mapped to the corresponding status code on the platform side by the main controller MCU. Each timeout threshold and each error code can be set according to actual needs, and this application does not impose any restrictions on this.

[0043] In one embodiment, allocating a logical channel for the target terminal in the maintained logical channel table includes: Step 402: If the target terminal has already occupied the first logical channel in the logical channel table, the first logical channel is used as the target logical channel, and the control command is written into the pending buffer of the first logical channel. Step 404: If the target terminal does not occupy a logical channel in the logical channel table, and there is an idle logical channel in the logical channel table, select the second logical channel as the target logical channel from among the idle logical channels. Step 406: If there is no idle logical channel in the logical channel table, add the control command to the pending queue and retry allocating the logical channel according to the preset period.

[0044] In one embodiment, the method further includes: Step 502: If the suspend queue is full, refuse to receive new control commands and generate status feedback information containing a system busy indicator; Step 504: If the waiting time of the control command in the suspend queue exceeds the preset suspend timeout threshold, the control command is removed from the suspend queue, and status feedback information containing the processing timeout flag is generated.

[0045] Specifically, the logical channel table can be a slot table with a capacity of 68. Each slot records the terminal address, occupancy flag, connection status, connection handle, service and attribute discovery results, parameter update readiness flag, and pending buffer. When issuing a command to the target terminal, if the target terminal already occupies a slot in the slot table (first logical channel), the slot already occupied by the same terminal is reused first; otherwise, an empty slot is allocated (second logical channel). If there are no empty slots, the command enters a 32-capacity pending queue, which is periodically retried and allocated by the serial port task. When the queue is full, a system busy error code is sent back to the master controller. If a command in the pending queue has not been issued within a preset time, it is dequeued and a processing timeout error code is sent back.

[0046] The multi-terminal access scheduling method provided in this application avoids interference from concurrent link establishment through a single connection pipeline; slot reuse ensures serial execution of instructions from the same terminal; and a reliable closed loop for the connection layer is formed by a 4-second connection timeout, 2 retries, and error code feedback.

[0047] Furthermore, in the multi-terminal access scheduling method provided in this application embodiment, the number of slots, the depth of the suspended queue, and each timeout threshold can all be configured according to the deployment scale; the slot allocation strategy can be expanded to priority-based preemption and pre-allocation based on terminal wake-up phase estimation.

[0048] The existing technology still has the following technical problems: platform retransmission leads to repeated execution of instructions by the terminal. When the platform retransmits the same instruction without receiving a result, if the terminal has already executed it (e.g., the controlled module has been powered on, or the address has been changed), it will execute it repeatedly, which may cause the controlled module to be powered on repeatedly, parameters to be written repeatedly, or even the address to be incorrectly rewritten. In the existing technology, each duplicate determination still requires a complete chain establishment, which has high air interface and power consumption costs, and there is a lack of a chain-establishment-free determination method that can be completed in the scanning stage.

[0049] To address the aforementioned technical problems, in one embodiment, the multi-terminal access scheduling method provided by this application further includes: Step 602: During the scanning phase, extract historical execution results from the broadcast signal of the target terminal; Step 604: Compare the feature fields of the control instructions with the historical execution results to obtain the comparison results; Step 606: If the comparison results are consistent, the control command is determined to be a duplicate command. Skip the step of initiating the physical connection and generate status feedback information containing the duplicate indication flag.

[0050] In one embodiment, the characteristic fields of the control instruction are compared with historical execution results to obtain the comparison result, including: Step 702: Extract the instruction identifier and command word from the control instructions as feature fields; Step 704: Compare the feature field with the corresponding result field in the historical execution results byte by byte. If the feature field and the result field are completely consistent, the comparison result is consistent. The comparison result is used to indicate that the target terminal has executed control instructions.

[0051] Specifically, during the scanning callback, the StarSpark client further parses the vendor-defined data field (type byte 0xFF) in the scan response of each legitimate terminal broadcast, extracting the "last execution result," i.e., the historical execution result. If there is a pending instruction in the terminal slot, the first 5 bytes of the pending instruction (instruction identifier + command word) are compared byte by byte with the first 5 bytes of the "last execution result" carried in the terminal broadcast. If they match, it is determined to be a duplicate instruction resent by the platform. At this time, the scanning is not stopped, no connection is initiated, and only a duplicate instruction event is posted to the event queue. The event task directly constructs a "original instruction + duplicate indication (0xFF)" response frame and sends it back to the master control and cleans up the slot. If they do not match, the normal connection establishment process is entered. This mechanism, together with the terminal-side connection deduplication, constitutes a two-level deduplication, ensuring that the terminal executes at most once and minimizes air interface overhead when the platform resends.

[0052] By setting up a scheduling mechanism that returns a "command duplicated" result without establishing a connection when the platform resends a command, air interface overhead is minimized; two-level deduplication ensures that the terminal executes at most once.

[0053] Furthermore, the comparison fields during the scanning phase can be expanded to a full comparison or hash comparison of "instruction identifier + command word + parameters"; in addition to being returned, the duplicate determination result can also directly trigger the platform-side instruction state machine to be set to completed.

[0054] The existing technology still has the following technical problems: the number of hardware connection channels of the StarSpark chip is limited, and the batch terminal inventory is time-consuming. When the StarSpark client chip (such as BS21E) is used as an SLE client, the maximum number of concurrent hardware connections is limited (maximum 8). Traditional solutions are constrained by this limit, and the number of terminals that can be served at the same time is small. The inventory of a batch of awakened terminals can only rely on waiting for each terminal to establish a connection one by one during its wake-up cycle. However, the terminal wake-up window is short (sub-second). During the queuing process, the broadcast window of a large number of terminals is missed, and they have to wait for the next wake-up cycle. A full inventory requires multiple wake-up cycles and is time-consuming. The existing technology lacks software scheduling methods to break through the chip connection limit and a method for rapid inventory of awakened terminals.

[0055] To address the aforementioned technical problems, in one embodiment, the multi-terminal access scheduling method provided by this application further includes the following steps: In an asset inventory scenario, the platform issues an inventory request, which is then broadcast sequentially by hundreds of terminals within the coverage area in their respective wake-up windows. The StarShine client continuously scans, and in the scan callback, it immediately registers each captured terminal broadcast into a 68-slot table (registering the terminal address, arrival time, and RSSI, without establishing a connection). Once the slot table is full, subsequently captured terminals are registered in a 32-slot pending queue to wait. When a broadcast from a registered terminal reappears, only the registration time is refreshed. After registration, the client establishes connections with terminals one by one in a single-connection pipeline according to slot order, issues inventory query commands, and receives feedback. After a connection is lost and a slot is released, terminals in the pending queue are sequentially replenished until all registered terminals have been processed. During this process, a closed-loop mechanism with a 4-second connection timeout and 2 retries ensures that the processing of a single terminal does not block the overall inventory. During the inventory process, the client transmits the results of the awakened terminals back to the main control MCU in real time via the onboard serial port. The main control MCU then reports to the platform in real time according to the topology change trigger mechanism, reporting one terminal for each inventory, until the platform obtains the full inventory results.

[0056] Furthermore, the inventory triggering method can be expanded to include platform broadcast commands, timed periodic inventory, or event-driven inventory; the processing order can be sorted by RSSI, address, or priority; the registration and chain building process can be expanded to include hierarchical inventory (first full scan registration, then batch chain building at selected times); the size of the virtual channel pool can be configured according to the deployment scale and chip model.

[0057] In this embodiment, the chip physical connection occupies only one (single connection pipeline), which is enough to complete the inventory of hundreds of awakened terminals; the inventory latency is reduced from "waiting for multiple wake-up cycles for each terminal" to "single window scanning registration + pipeline processing"; the software channel pool with 68 candidate slots + 32 queues allows the number of registerable terminals to far exceed the hardware limit of 8 channels of the BS21 chip, achieving a breakthrough in chip capability.

[0058] This application provides a multi-terminal access scheduling method, which addresses various technical problems in the prior art and proposes the following solutions: 1. Slot-based multi-terminal access management + single-connection pipeline + layered timeout retry and error code closed-loop: 68-slot table, global "connecting" flag, 4-second connection timeout and 2 retries, suspension queue, 0x00~0x05 error code system and its platform-side status code mapping. 2. Duplicate instruction detection without link establishment during the scanning phase (two-level deduplication): The scan response carries the previous result and compares it with the first 5 bytes of the pending instruction. If they match, a duplicate indication is returned without link establishment, which is combined with the terminal-side connection-based deduplication.

[0059] 3.68 candidate slots + 32 queue waiting virtual channel pool and rapid inventory of awakened terminals: The software logic channel breaks through the hardware connection limit of the BS21 chip of up to 8 channels. The three-level structure of "1 active physical connection + 68 candidate slots + 32 queue waiting" is used for time-division multiplexing. The scanning "discovery and registration" + single connection pipeline realizes rapid inventory of batch awakened terminals in a single window.

[0060] The multi-terminal access scheduling method provided in this application has at least the following beneficial effects: 1. Orderly and crosstalk-free access: Slot-based channel management and single-connection pipeline ensure that the access of batch terminals is strictly serialized. Multiple instructions from the same terminal are executed serially in the same slot, eliminating interference from concurrent connection establishment and instruction overwriting.

[0061] 2. Command results are always returned, and failure reasons can be distinguished: exceptions such as connection failure / timeout / terminal not present / system busy all generate clear error codes through layered timeout and retry mechanisms and are returned to the platform, so the platform does not need to blindly resend; the suspension queue ensures that sudden commands are not lost.

[0062] 3. Minimize air interface overhead: The duplicate instruction detection without link establishment during the scanning phase ensures that the platform returns the result with "zero link establishment" when resending instructions. Combined with the terminal-side connection deduplication, it forms a two-level deduplication, and the terminal executes at most once.

[0063] 4. Breaking through the chip connection limit: With a virtual channel pool of 68 candidate slots + 32 queue waiting and time-division multiplexing of a single physical link, the number of on-network terminals that the StarSpark client can serve far exceeds the hardware limit of a maximum of 8 channels of the BS21 chip, achieving a software-layer breakthrough in chip capabilities.

[0064] 5. Rapid Batch Terminal Inventory: Scanning "Discover and Register" allows batches of awakened terminals to complete registration and inventory within a single window, significantly reducing inventory latency and enabling the platform to quickly obtain a complete list of awakened terminals.

[0065] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0066] Based on the same inventive concept, this application also provides a multi-terminal access scheduling apparatus for implementing the multi-terminal access scheduling method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more embodiments of the multi-terminal access scheduling apparatus provided below can be found in the limitations of the multi-terminal access scheduling method described above, and will not be repeated here.

[0067] In one exemplary embodiment, such as Figure 2 As shown, a multi-terminal access scheduling device is provided, comprising: The allocation module is used to acquire control commands for the target terminal and allocate the corresponding target logical channel to the target terminal in a preset logical channel table. The connection establishment module is used to stop scanning and initiate a physical connection to the target terminal when a broadcast signal from the target terminal is detected. The sending module is used to send control commands to the target terminal in response to the establishment of a physical connection; the control commands are used to instruct the target terminal to perform corresponding tasks and to provide feedback on the corresponding execution results. The processing module is used to respond to preset timeout or failure conditions triggered during the connection establishment process or the execution of control commands, perform corresponding processing actions based on preset exception handling strategies, and generate corresponding status feedback information.

[0068] In one embodiment, a flag management module is also included, for: When a broadcast signal from a target terminal is detected, the global connection status flag is set and the scanning stops. In response to establishing a physical connection, a parameter negotiation process is performed with the target terminal, and after the parameter negotiation is completed, the parameter update ready flag corresponding to the target terminal is recorded in the logical channel table. The sending and receiving of control commands is triggered based on the parameter update ready flag, and the parameter update ready flag is cleared after the sending and receiving are completed. After disconnecting the physical connection with the target terminal, clear the global connection status flags and restart the scan.

[0069] In one embodiment, the processing module is further configured to: If a physical connection is not successfully established within a preset connection timeout threshold after initiation, the physical connection is cancelled and retry counts are performed independently for each logical channel. In response to the retry count reaching the preset retry limit, the logical channel is cleaned up, and a status feedback message containing a connection failure identifier is generated.

[0070] In one embodiment, the allocation module is further configured to: If the target terminal has already occupied the first logical channel in the logical channel table, the first logical channel will be used as the target logical channel, and the control command will be written into the pending buffer of the first logical channel. If the target terminal does not occupy a logical channel in the logical channel table, and there is an idle logical channel in the logical channel table, select the second logical channel as the target logical channel from among the idle logical channels; If there is no free logical channel in the logical channel table, the control command is added to the pending queue, and the allocation of logical channels is retried according to the preset period.

[0071] In one embodiment, a queue management module is also included, for: If the pending queue is full, refuse to accept new control commands and generate a status feedback message containing a system busy indicator; If the waiting time of a control command in the suspend queue exceeds the preset suspend timeout threshold, the control command will be removed from the suspend queue, and a status feedback message containing a processing timeout flag will be generated.

[0072] In one embodiment, a comparison module is also included, for: During the scanning phase, historical execution results are extracted from the broadcast signals of the target terminal; The characteristic fields of the control instructions are compared with the historical execution results to obtain the comparison results; If the comparison results are consistent, the control command is determined to be a duplicate command, the step of initiating a physical connection is skipped, and status feedback information containing a duplicate indication is generated.

[0073] In one embodiment, the comparison module is further configured to: Extract the instruction identifier and command word from the control instructions as feature fields; The feature field is compared byte by byte with the corresponding result field in the historical execution results. If the feature field and the result field are completely consistent, the comparison result is considered consistent. The comparison result is used to indicate that the target terminal has executed control instructions.

[0074] In one embodiment, a computer device is provided, including a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps in the above method embodiments.

[0075] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0076] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The components described as separate parts may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0077] The above-described embodiments are merely illustrative of several implementation methods of the embodiments of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the embodiments of this application, and these modifications and improvements all fall within the protection scope of the embodiments of this application.

Claims

1. A multi-terminal access scheduling method, characterized in that, The method includes: Obtain control commands for the target terminal and allocate a corresponding target logical channel for the target terminal in a preset logical channel table; When a broadcast signal from the target terminal is detected, the scanning is stopped, and a physical connection is initiated to the target terminal. In response to establishing a physical connection, the control command is sent to the target terminal; the control command is used to instruct the target terminal to perform a corresponding task and provide feedback on the corresponding execution result. In response to the triggering of preset timeout or failure conditions during the connection establishment process or the execution of the control command, the corresponding processing action is executed based on the preset exception handling strategy, and corresponding status feedback information is generated.

2. The method according to claim 1, characterized in that, The method further includes: When a broadcast signal from the target terminal is detected, the global connection status flag is set and the scanning stops. In response to establishing a physical connection, a parameter negotiation process is performed with the target terminal, and after the parameter negotiation is completed, the parameter update ready flag corresponding to the target terminal is recorded in the logical channel table. The control command transmission and reception operation is triggered based on the parameter update ready flag, and the parameter update ready flag is cleared after the transmission and reception are completed; After disconnecting the physical connection with the target terminal, clear the global connection status flag and restart the scan.

3. The method according to claim 2, characterized in that, The system responds to preset timeout or failure conditions triggered during connection establishment or execution of control commands, performs corresponding processing actions based on a preset exception handling strategy, and generates status feedback information containing a failure reason identifier, including: If a physical connection is not successfully established within a preset connection timeout threshold after initiation, the physical connection is cancelled, and retry counting is performed independently for each logical channel. In response to the retry count reaching a preset retry limit, the logical channel is cleared, and status feedback information containing a connection failure identifier is generated.

4. The method according to claim 1, characterized in that, The step of allocating a logical channel to the target terminal in the maintained logical channel table includes: If the target terminal has already occupied the first logical channel in the logical channel table, the first logical channel is used as the target logical channel, and the control command is written into the pending buffer of the first logical channel; If the target terminal does not occupy a logical channel in the logical channel table, and there is an idle logical channel in the logical channel table, the second logical channel is selected as the target logical channel from among the idle logical channels; If there is no idle logical channel in the logical channel table, the control command is added to the suspend queue, and the allocation of logical channels is retried according to a preset period.

5. The method according to claim 4, characterized in that, The method further includes: If the suspended queue is full, new control commands are rejected, and the status feedback information containing a system busy indicator is generated. If the waiting time of the control command in the suspend queue exceeds a preset suspend timeout threshold, the control command is removed from the suspend queue, and the status feedback information containing a processing timeout flag is generated.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: During the scanning phase, historical execution results are extracted from the broadcast signals of the target terminal; The characteristic fields of the control instruction are compared with the historical execution results to obtain the comparison results; If the comparison results are consistent, the control command is determined to be a duplicate command, the step of initiating a physical connection is skipped, and the status feedback information containing a duplicate indication is generated.

7. The method according to claim 6, characterized in that, The step of comparing the feature fields of the control instruction with the historical execution results to obtain the comparison result includes: Extract the instruction identifier and command word from the control instruction as the feature field; The feature field is compared byte by byte with the corresponding result field in the historical execution results. If the feature field and the result field are completely consistent, the comparison result is considered to be consistent. The comparison result is used to indicate that the target terminal has executed the control instruction.

8. A multi-terminal access scheduling device, characterized in that, The device includes: The allocation module is used to acquire control commands for the target terminal and allocate a corresponding target logical channel for the target terminal in a preset logical channel table. The connection establishment module is used to stop scanning and initiate a physical connection to the target terminal when a broadcast signal of the target terminal is detected. The sending module is used to send the control command to the target terminal in response to the establishment of a physical connection; the control command is used to instruct the target terminal to perform a corresponding task and return the corresponding execution result. The processing module is used to respond to preset timeout conditions or failure conditions triggered during the connection establishment process or the execution of the control command, perform corresponding processing actions based on preset exception handling strategies, and generate corresponding status feedback information.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.