Gateway task processing method and system, gateway and storage medium

By forming temporary task groups among capable gateways and synchronizing task completion, the method prevents redundant operations, reducing resource waste and enhancing efficiency in material handling systems.

CN120321068APending Publication Date: 2025-07-15SHENZHEN MINEW TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510533972.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-07-15

AI Technical Summary

Technical Problem

In the Internet of Things system, multiple gateways perform repeated operations on the same terminal device, resulting in waste of resources and inefficient task execution.

Method used

Before receiving the task command, the gateway determines whether it can perform tasks, creates a gateway group for the target task, and adds itself to the group. After successful execution, synchronizes the task completion information to avoid repeated operations by other gateways.

Benefits of technology

By establishing gateway groups and information synchronization, repeated operations are avoided, task execution efficiency is improved, and resource waste is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120321068A_ABST
    Figure CN120321068A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of gateway management, and provides a gateway task processing method and system, a gateway and a storage medium, and the method comprises the steps: after a first gateway receives a group creation instruction, the first gateway determines whether the first gateway can execute a target task in the group creation instruction; if the first gateway determines that the first gateway can execute the target task, the first gateway establishes a gateway group of the target task and adds the first gateway into the established gateway group; according to the method, all gateways capable of executing the target task are stored in the same gateway group; if the first gateway completes the target task, the first gateway synchronizes a successful execution message of the target task to other gateways in the gateway group, so that other gateways in the gateway group no longer operate the target task; and the condition that different gateways perform repeated operation on the same task is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of gateway management, and particularly relates to a task processing method, system, gateway, and storage medium for a gateway. Background Art

[0002] The Internet of Things refers to a technical network that connects various physical devices, sensors, intelligent terminals, etc. through the Internet to achieve data collection, transmission, processing, and application. A gateway is a key device in the Internet of Things system, responsible for connecting different terminal devices, cloud or local servers, and realizing functions such as data collection, protocol conversion, edge computing, and secure communication.

[0003] In the Internet of Things system, such as the electronic tag Internet of Things, there are multiple gateways and multiple terminal devices. In order to enable all terminal devices to be interconnected with the gateway, it often occurs that gateways in different regions are connected to the same terminal device. Based on the above connections, when an operation needs to be performed on a terminal device, since multiple gateways can be interconnected with the terminal device, different gateways perform repeated operations on the same terminal device, resulting in problems such as resource waste and low task execution efficiency. Summary of the Invention

[0004] The embodiments of this application provide a task processing method, system, gateway, and storage medium for a gateway, which can solve the problem that different gateways perform repeated operations on the same terminal device, resulting in resource waste and low task execution efficiency.

[0005] In a first aspect, the embodiments of this application provide a task processing method for a gateway, including:

[0006] After a first gateway receives a group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction. The group creation instruction is an instruction generated by a platform server according to the target task to be executed and sent to at least one of the gateways. The first gateway is any one of the multiple gateways;

[0007] If the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group;

[0008] If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group. The successful execution information is used for the other gateways not to process the target task after receiving the successful execution information.

[0009] In a possible implementation of the first aspect, after the first gateway determines whether it can execute the target task in the group creation instruction, the method further includes:

[0010] If the first gateway determines that it cannot execute the target task, the first gateway ignores the group creation instruction.

[0011] In a possible implementation of the first aspect, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes:

[0012] The first gateway sends a group creation success message to the platform server, where the group creation success message is used to instruct the platform server to store the gateway group and to instruct the platform server to send operation instructions of the target task to each gateway in the gateway group;

[0013] Correspondingly, after the first gateway receives the operation instruction, the first gateway sends a connection message to the terminal device corresponding to the target task, where the terminal device is the object on which the target task is executed, and the connection message is used to instruct the terminal device to create a communication connection with the first gateway;

[0014] After the first gateway and the terminal device successfully create a communication connection, the first gateway executes the target task.

[0015] In a possible implementation of the first aspect, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes:

[0016] If the first gateway does not execute the target task and the first gateway receives success execution information of the target task sent by a second gateway, where the second gateway is the gateway in the gateway group that executes the target task;

[0017] The first gateway marks the stored target task as a task completed state.

[0018] In a possible implementation of the first aspect, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes:

[0019] The first gateway sends a message subscription notice to the communication server, where the message subscription notice is used to instruct the communication server to synchronize messages sent by other gateways in the gateway group to the first gateway and to instruct the communication server to synchronize messages sent by the first gateway to other gateways in the gateway group.

[0020] In a possible implementation of the first aspect, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group, including:

[0021] The first gateway sends the successful execution message to the communication server, where the successful execution message is used to instruct the communication server to send the successful execution message to other gateways in the gateway group, and to instruct the other gateways to mark the target task stored by themselves as the task completed state after receiving the successful execution message.

[0022] In a possible implementation of the first aspect, if the first gateway successfully executes the target task, the method further includes:

[0023] The first gateway sends the task execution result to the platform server, and the task execution result is used to notify the platform server that the target task has been successfully executed.

[0024] In a second aspect, an embodiment of the present application provides a task processing system for a gateway, including: a platform server and multiple gateways;

[0025] When the platform server determines the target task to be executed, the platform server generates a group creation instruction for the target task, and the platform server sends the group creation instruction to at least one gateway;

[0026] After the first gateway receives the group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction, and the first gateway is any one of the multiple gateways;

[0027] If the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group;

[0028] If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group;

[0029] After receiving the successful execution information, the other gateways no longer process the target task.

[0030] In a third aspect, an embodiment of the present application provides a gateway for implementing the task processing method of the gateway described in any one of the first aspects above.

[0031] Fourthly, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which when executed by a processor, implements the task processing method of the gateway described in any one of the first aspects above.

[0032] Fifthly, an embodiment of the present application provides a computer program product, which when running on a terminal device, causes the terminal device to execute the task processing method of the gateway described in any one of the first aspects above.

[0033] The beneficial effects of the first aspect of the present application compared with the prior art are as follows: after the first gateway receives a group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction; if the first gateway determines that it can execute the target task, the first gateway itself creates a gateway group for the target task and adds itself to the created gateway group; in this way, all gateways that can execute the target task are saved in the same gateway group; if the first gateway completes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group, so that other gateways in the gateway group no longer operate on the target task; this avoids the situation where different gateways perform repeated operations on the same task.

[0034] It can be understood that the beneficial effects of the second to fifth aspects above can refer to the relevant descriptions in the first aspect above, and will not be elaborated here. Description of the Drawings

[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0036] Figure 1 is a schematic diagram of an Internet of Things system provided by an embodiment of the present application;

[0037] Figure 2 is a schematic diagram of an electronic tag Internet of Things system provided by an embodiment of the present application;

[0038] Figure 3 is a schematic flow chart of the task processing method of the gateway provided by an embodiment of the present application;

[0039] Figure 4 is a schematic flow chart of the method for information synchronization between gateways provided by an embodiment of the present application;

[0040] Figure 5It is a schematic flowchart of a task processing method of a gateway provided by another embodiment of the present application;

[0041] Figure 6 It is a schematic structural diagram of a gateway provided by an embodiment of the present application. Detailed implementation manners

[0042] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their combinations.

[0043] It should also be understood that the term "and / or" used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0044] As used in the specification and appended claims of the present application, the term "if" can be interpreted as "when" or "once" or "in response to determining" or "in response to detecting" according to the context. Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted as meaning "once determined" or "in response to determining" or "once [the described condition or event] is detected" or "in response to detecting [the described condition or event]" according to the context.

[0045] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0046] The reference to "an embodiment" or "some embodiments" or the like described in the specification of the present application means that a specific feature, structure or characteristic described in combination with the embodiment is included in one or more embodiments of the present application. Thus, the statements "in an embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0047] In an Internet of Things (IoT) system, a distributed architecture is usually adopted, and multiple gateways are deployed in different areas to expand the coverage. In order to cover all terminal devices as much as possible with the gateways, it often happens that different gateways cover the same terminal device, that is, different gateways cover the same area. When an operation needs to be performed on one or more terminal devices, such as information update, execution of control instructions, or firmware upgrade of the terminal device, since different gateways can all receive the task sent by the server, after one gateway performs the task operation on the terminal device, another gateway will repeat the task operation on the terminal device, resulting in waste of resources, low task execution efficiency, and data errors, etc.

[0048] For example, Figure 1 the shown IoT system includes gateway A, gateway B, gateway C, and gateway D. Gateway A can operate on electronic tag a and electronic tag b; gateway B can operate on electronic tag b and electronic tag c; gateway C can operate on electronic tag d, electronic tag e, and electronic tag f; gateway D can operate on electronic tag f and electronic tag g. An electronic tag refers to an electronic identification tag attached to a commodity or other item for storing and transmitting information. Both gateway A and gateway B can operate on electronic tag b. If an operation needs to be performed on electronic tag b, both gateway A and gateway B can receive the task of performing the operation on electronic tag b. Then, after gateway A performs the task operation on electronic tag b, gateway B repeats the same task operation on electronic tag b, resulting in a situation of repeated operations.

[0049] Based on the above problems, the present application proposes a task processing method for a gateway. Before executing a target task, the gateway can first determine whether it can execute the target task. If the gateway determines that it can execute the target task, the gateway creates a gateway group for the target task, then sets itself as a member of the gateway group, and further all gateways that can execute the target task are set in the gateway group to form a temporary group for the target task. After a gateway in the gateway group completes the target task, it synchronizes the task completion information to other gateways in the gateway group, so that other gateways in the gateway group no longer execute the target task, avoiding repeated operations of different gateways on the same task.

[0050] Next, taking the operation of the gateway on the electronic tag as an example for illustration. Refer to Figure 2The shown Internet of Things (IoT) system of electronic tags includes a platform server, a communication server, gateway A, gateway B, gateway C, gateway D, electronic tag a, electronic tag b, electronic tag c, electronic tag d, electronic tag e, electronic tag f, and electronic tag g. Gateway A can operate on electronic tag a and electronic tag b; Gateway B can operate on electronic tag b and electronic tag c; Gateway C can operate on electronic tag d, electronic tag e, and electronic tag f; Gateway D can operate on electronic tag f and electronic tag g.

[0051] The platform server can directly send a group creation instruction including task information to each gateway. The gateway establishes a group related to the task based on the received task information, and then completes the relevant task operation.

[0052] As an example, if it is necessary to execute a target task, such as an upgrade task, on electronic tag b, the platform server sends a group creation instruction for the target task to gateway A, gateway B, gateway C, and gateway D (or gateway A, gateway B, and gateway C, etc., but at least including gateway A and gateway B).

[0053] After receiving the group creation instruction, gateway A determines that it can complete the target task. Gateway A creates gateway group X for the target task and adds itself to gateway group X. The operation of gateway B is the same as that of gateway A and will not be elaborated here. Gateway A and gateway B send a subscription message for gateway group X to the communication server.

[0054] After receiving the group creation instruction, gateway C determines that it cannot complete the target task, and gateway C ignores the group creation instruction. The operation of gateway D is the same as that of gateway C and will not be elaborated here.

[0055] If gateway A successfully establishes a connection with electronic tag b, gateway A starts to execute the target task. After gateway A completes the target task, gateway A sends a task completion message to the communication server.

[0056] After receiving the task completion message sent by gateway A, the communication server sends the task completion message to gateway B.

[0057] After receiving the task completion message sent by the communication server, gateway B no longer operates on the target task.

[0058] Next, in combination with Figure 2 The task processing method of the gateway in the embodiment of this application will be described in detail.

[0059] Figure 3 The schematic flowchart of the task processing method of the gateway provided in this application is shown. Referring to Figure 3 , the details of this method are as follows:

[0060] S101. After the first gateway receives a group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction. The group creation instruction is an instruction generated by the platform server according to the target task to be executed and sent to at least one of the gateways. The first gateway is any one of multiple gateways.

[0061] In this embodiment, the target task can be one or more. The target task can be an operation on a single terminal device or an operation on multiple terminal devices.

[0062] In this embodiment, the platform server generates a group creation instruction related to the target task according to the task requirements. The group creation instruction may include an identifier related to the target task or the target task. The identifier can be the ID of the object on which the target task is executed, etc. For example, in a retail scenario, the identifier can be merchant ID + operation code or store ID + operation code, etc. The operation code is data used to uniquely identify the current operation and is used to distinguish different batches or types of operations. In a warehousing scenario, the identifier can be warehouse item number or inventory task ID, etc. In an industrial control scenario, the identifier can be device ID or inspection session ID, etc.

[0063] After generating the group creation instruction, the platform server sends the group creation instruction to at least one gateway. Alternatively, the platform server pre-stores the regions where each gateway is located and the regions where each terminal device (such as an electronic tag) is located. The platform server filters out potential gateways that can execute the target task according to the region where the target task is located, and the platform server sends the group creation instruction to each potential gateway. Alternatively, the platform server pre-stores the tasks that each gateway can execute. The platform server filters out potential gateways that can execute the target task according to the target task, and the platform server sends the group creation instruction to each potential gateway.

[0064] In this embodiment, the first gateway can determine whether it is in the same region as the execution object of the target task (such as an electronic tag) according to its own region. If the first gateway is in the same region as the execution object of the target task, the first gateway determines that it can establish a communication connection with the execution object of the target task, and the first gateway determines that it can execute the target task. If the first gateway is not in the same region as the execution object of the target task, the first gateway determines that it cannot execute the target task. For example, referring to Figure 2 , if it is necessary to perform a task on electronic tag b, and gateway A determines that it is in the same region as electronic tag b, then gateway A determines that it can execute the target task.

[0065] The first gateway can determine whether it can execute the target task according to its own performance, etc. Alternatively, tasks that the first gateway can execute are pre-stored in the first gateway. After receiving the group creation instruction, the first gateway determines whether it can execute the target task according to the pre-stored tasks that it can execute.

[0066] It should be noted that if the group creation instruction includes an identifier related to the target task, after receiving the group creation instruction, the first gateway parses the identifier of the target task to determine whether it can execute the target task.

[0067] S102, if the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group.

[0068] In this embodiment, when the gateway creates a gateway group related to the target task, in order to make the group names of the gateway groups of the target tasks created by each gateway the same, the identifier of the target task can be used as the group name of the gateway group. Alternatively, group names corresponding to each task are pre-stored in each gateway. When creating a gateway group corresponding to the target task, the group name corresponding to the target task is searched for, and the group name corresponding to the target task is determined as the group name of the created gateway group related to the target task. Alternatively, a generation rule for the group name is pre-set in the gateway, and the generation rules for the group names of the same task in each gateway are the same. The gateway generates the group name of the gateway group related to the target task according to the target task and the pre-stored generation rule. For example, the generation rule can include performing data transformation on the identifier of the target task, etc.

[0069] Adding itself to the gateway group means marking itself as a member of the gateway group.

[0070] In this embodiment, if the second gateway determines that it can execute the target task, the second gateway creates a gateway group related to the target task and adds itself to the gateway group. The gateway groups related to the target task created by the first gateway and the second gateway are the same. The second gateway is any one of the multiple gateways and is different from the first gateway. Each gateway in the gateway group is a gateway that can execute the target task.

[0071] For example, Figure 2 after the platform server in sends a group creation instruction to gateway A and gateway B, if gateway A determines that it can execute the target task in the group creation instruction, then gateway A creates gateway group X; gateway B also creates gateway group X, and both gateway A and gateway B join gateway group X.

[0072] In another embodiment, if the first gateway determines that it cannot execute the target task, the first gateway ignores the group creation instruction and does not process the group creation instruction.

[0073] S103. If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group, and the successful execution information is used for the other gateways not to process the target task after receiving the successful execution information.

[0074] In this embodiment, after the first gateway creates the gateway group, the first gateway broadcasts the group creation information so that other gateways can know that the first gateway has created the gateway group for the target task and the first gateway is a member of the gateway group. The first gateway can also receive the group creation information sent by other gateways to know which gateway has joined the gateway group.

[0075] After the gateway group is created, each gateway in the gateway group sends a connection message to the terminal device that needs to execute the task; if the first gateway establishes a communication connection with the terminal device, the first gateway starts to execute the target task on the terminal device. For example, as Figure 2 shown, both gateway A and gateway B are in the gateway group. Gateway A sends a connection message to the electronic tag b, and gateway B sends a connection message to the electronic tag b; if the connection between gateway A and the electronic tag b is successful, then gateway A executes the target task on the terminal device. Gateway A is the first gateway.

[0076] After the first gateway completes the target task, the first gateway generates a successful execution message of the target task, and the first gateway sends the successful execution message of the target task to other gateways in the gateway group. After receiving the successful execution message of the target task, the other gateways in the gateway group mark the target task stored in themselves as the completed state to avoid repeated operations on the target task. The successful execution message of the target task may include the identifier of the target task (for example, the electronic tag ID). After receiving the successful execution message, the other gateways update the record of the already operated tasks or the record of the already operated electronic tags stored locally by themselves to ensure that they will no longer operate on the target task or the electronic tag subsequently.

[0077] In another embodiment, after the first gateway completes the target task, it stores the successful execution message of the target task in the database, and other gateways in the gateway group determine whether the target task is completed by accessing the database. If other gateways in the gateway group determine that the target task has been completed, they will not process the target task.

[0078] In another embodiment, if the first gateway is not the gateway in the gateway group that executes the target task, that is, the first gateway does not execute the target task. If the second gateway establishes a connection with the terminal device and the second gateway executes the target task, after the second gateway successfully executes the target task, the second gateway synchronizes the successful execution message of the target task to other gateways in the gateway group. If the first gateway receives the successful execution information of the target task sent by the second gateway; the first gateway marks the stored target task as the task completion status, and the first gateway no longer processes the target task.

[0079] In another embodiment, if the first gateway successfully executes the target task, the first gateway sends the task execution result to the platform server, and the task execution result is used to notify the platform server that the target task has been successfully executed.

[0080] The task execution result may include the number of tasks completed by itself and the identifier of the completed target task (such as the electronic tag ID), etc. After receiving the task execution result, the platform server summarizes and manages the completed tasks.

[0081] In this application, after the first gateway receives the group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction; if the first gateway determines that it can execute the target task, the first gateway itself creates a gateway group for the target task and adds itself to the created gateway group; in this way, all gateways that can execute the target task are saved to the gateway group; if the first gateway completes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group, so that other gateways in the gateway group no longer operate on the target task; to avoid the situation where different gateways perform repeated operations on the same task.

[0082] In a possible implementation manner, in order to implement information synchronization among the gateways in the gateway group, the gateways in the gateway group can establish an instant communication channel with each other in the form of subscribing to messages of the gateway group, so as to broadcast their own messages and receive messages of other gateways, achieving the purpose of information synchronization among the gateways in the gateway group.

[0083] Specifically, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the above method may further include:

[0084] The first gateway sends a message subscription notification to the communication server, and the message subscription notification is used to instruct the communication server to synchronize the messages sent by other gateways in the gateway group to the first gateway, and to instruct the communication server to synchronize the messages sent by the first gateway to other gateways in the gateway group.

[0085] In this embodiment, after receiving the message subscription notification, the communication server stores the gateway group and the gateway members in the gateway group.

[0086] After the first gateway successfully executes the target task and sends a successful execution message to the communication server, the communication server sends the successful execution message to other gateways in the gateway group. After receiving the successful execution message, the other gateways in the gateway group mark the target task stored by themselves as the task completed state.

[0087] In this embodiment, the communication server can be a server of Message Queuing Telemetry Transport (MQTT). The message transmission between the gateway and the communication server is all carried out using MQTT messages. Alternatively, the communication between gateways can use protocols such as CoAP (The Constrained Application Protocol), Advanced Message Queuing Protocol (AMQP), etc., which are not limited here.

[0088] Specifically, after the first gateway successfully executes the target task, the first gateway first marks the target task stored by itself as the completed state and records information such as the operation type and operation time. For example, after the first gateway completes the operation on the electronic tag b, the first gateway marks the electronic tag b as the completed state and records the operation type and operation time of the operation on the electronic tag b, etc. Each completed target task can be stored in the form of a list.

[0089] The first gateway sends a successful execution message of the target task to other gateways in the gateway group through the established MQTT channel. The successful execution message can include the operation type of the operation performed on the terminal device, the ID of the terminal device, etc. For example, the ID of the electronic tag and the operation type of the operation performed on the electronic tag, etc.

[0090] As an example, as Figure 4 shown in the schematic diagram of the data synchronization process between gateways, the method for message synchronization includes:

[0091] S11, the platform server sends an operation instruction of the target task to gateway A, and the target task is an operation task for the electronic tag b.

[0092] S12, gateway A performs the operation on the electronic tag b.

[0093] S13, after gateway A completes the target task, gateway A generates a successful execution message of the target task.

[0094] S14, gateway A marks the target task as the operated state.

[0095] S15. The gateway A sends a message indicating the successful execution of the target task to the communication server. The successful execution message includes the group name of the gateway group where the gateway A is located, the status of the electronic tag b, etc.

[0096] S16. After receiving the successful execution message, the communication server sends the successful execution message to the gateway B.

[0097] S17. After receiving the successful execution message, the gateway B marks the target task as the operated status.

[0098] S18. The platform server sends an operation instruction for the target task to the gateway B. The target task is an operation task for the electronic tag b.

[0099] S19. After receiving the target task, the gateway B checks the local record, determines that the target task has been completed, and the gateway B ignores the target task.

[0100] In a possible implementation manner, after creating the gateway group, in order to let the platform server understand the creation result of the gateway group and the members in the gateway group, the gateway that creates the gateway group sends a group creation success message to the platform server. After receiving the group creation success message, the platform server stores the gateway groups created by each gateway and stores the gateways included in the gateway groups.

[0101] After receiving the group creation success message, the platform server can send an operation instruction for the target task to each gateway in the gateway group to instruct the gateways in the gateway group to start executing the target task.

[0102] Specifically, after the first gateway creates a gateway group related to the target task and joins itself into the gateway group, the above method may further include:

[0103] The first gateway sends a group creation success message to the platform server, where the group creation success message is used to instruct the platform server to store the gateway group and to instruct the platform server to send the operation instruction for the target task to each gateway in the gateway group.

[0104] Correspondingly, after the first gateway receives the operation instruction, the first gateway sends a connection message to the terminal device corresponding to the target task. The terminal device is the object on which the target task is executed. The connection message is used to instruct the terminal device to create a communication connection with the first gateway; after the first gateway and the terminal device successfully create a communication connection, the first gateway executes the target task.

[0105] In this embodiment, the group creation success message includes the group name of the gateway group created by the first gateway and the members in the gateway group. After receiving the group creation success message, the platform server stores the group name of the gateway group and integrally stores each gateway in the gateway group.

[0106] After receiving the group creation success message, the platform server may send operation instructions for the target task to each gateway in the gateway group. For example, the operation instructions may include instructions for sending down data, uploading data, or upgrading data, etc.

[0107] After each gateway in the gateway group receives the operation instructions for the target task, each gateway sends a connection message to the terminal device, and the gateway successfully connected to the terminal device executes the target task.

[0108] It should be noted that the step of the first gateway subscribing to the messages of the gateway group and the step of the first gateway sending the group creation success message to the platform service can be carried out simultaneously. Alternatively, the first gateway subscribes to the messages of the gateway group first, and then sends the group creation success message to the platform server.

[0109] In a possible implementation manner, referring to Figure 2 the task processing system of the gateway shown in Figure 5 and the task processing method of the gateway in

[0110] S21, the platform server sends a task instruction to the gateway. The task instruction may be a group creation instruction for the target task or an operation instruction for the target task. The target task is the operation performed on the electronic tag b.

[0111] S22 After receiving the task instruction, the gateway parses the task instruction to determine whether the task instruction is a group creation instruction.

[0112] S23, if the task instruction is a group creation instruction, the gateway determines that it can complete the target task in the group creation instruction, the gateway creates a gateway group for the target task, and adds itself to the gateway group. For example, gateway A and gateway B create a gateway group and add themselves to the gateway group.

[0113] S24, the gateway that joins the gateway group sends a message subscription notification of the gateway group to the communication server. After receiving the message subscription notification, the communication server stores the gateway group and the members in the gateway group (gateway A and gateway B).

[0114] S25. The gateways in the gateway group send a group creation success message to the platform server. After receiving the group creation success message, the platform server stores the gateway group and the members in the gateway group. The platform server generates an operation instruction for the target task and sends the task instruction, which is the operation instruction for the target task, to the gateways (Gateway A and Gateway B) in the gateway group.

[0115] S26. If the task instruction is the operation instruction for the target task, the gateway executes the target task. For example, when Gateway A receives the operation instruction for the target task, Gateway A sends a connection message to electronic tag b. When Gateway B receives the operation instruction for the target task, Gateway B sends a connection message to electronic tag b. After Gateway A successfully connects to electronic tag b, Gateway B cannot connect to electronic tag b. Gateway A executes the target task. After completing the target task, Gateway A generates a success execution message for the target task.

[0116] S27. After the gateway executes the target task, the gateway determines whether it is in the gateway group. For example, after Gateway A executes the target task, it determines whether it is in the gateway group.

[0117] S28. If the gateway determines that it is in the gateway group, the gateway sends a success execution message for the target task to the communication server.

[0118] S29. After the communication server receives the success execution message for the target task, the communication server sends the success execution message for the target task to the other gateways (Gateway B) in the gateway group.

[0119] S30. After the other gateway (Gateway B) receives the success execution message for the target task, it sets the target task stored in itself to the task completed state to avoid repeated operations on the target task.

[0120] S31. If the gateway (Gateway A) that has completed the target task determines that it is not in the gateway group, the gateway that has completed the target task updates the status of the target task stored in itself.

[0121] In this application, by establishing a temporary gateway group for the target task, the repeated operations on the same electronic tag are significantly reduced, and the management efficiency of the platform server for the electronic tag is improved. It is especially suitable for the Internet of Things scenarios that require quick response and temporary grouping. Even when multiple gateways cover the same area or participate in the same task, through real-time status marking and synchronization, it can be ensured that each electronic tag is only processed once in one operation, avoiding data conflict and inconsistency problems. The operation status synchronization and conflict avoidance are realized inside the gateway group, reducing the burden of redundant instructions and conflict detection that the platform needs to handle.

[0122] It should be understood that the sequence numbers of the steps in the above embodiments do not indicate the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0123] Corresponding to the task processing method of the gateway described in the above embodiments, an embodiment of the present application provides a task processing system for a gateway. The system includes a platform server and multiple gateways.

[0124] When the platform server determines the target task to be executed, the platform server generates a group creation instruction for the target task, and the platform server sends the group creation instruction to at least one gateway.

[0125] After the first gateway receives the group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction. The first gateway is any one of the multiple gateways.

[0126] If the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group.

[0127] If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group.

[0128] After receiving the successful execution information, the other gateways will no longer process the target task.

[0129] In a possible implementation manner, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the system may further include:

[0130] If the first gateway does not execute the target task and the first gateway receives the successful execution information of the target task sent by the second gateway, where the second gateway is the gateway in the gateway group that executes the target task.

[0131] The first gateway marks the stored target task as a task completed state.

[0132] In a possible implementation manner, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the system may further include:

[0133] The first gateway sends a group creation success message to the platform server.

[0134] After the platform server receives the successful group creation message, the platform server stores the gateway group;

[0135] The platform server sends an operation instruction of the target task to each gateway in the gateway group;

[0136] Correspondingly, after the first gateway receives the operation instruction, the first gateway sends a connection message to the terminal device corresponding to the target task, where the terminal device is the object on which the target task is executed, and the connection message is used to instruct the terminal device to create a communication connection with the first gateway;

[0137] After the first gateway and the terminal device successfully create a communication connection, the first gateway executes the target task.

[0138] In a possible implementation, after the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the system may further include:

[0139] The first gateway sends a message subscription notice to the communication server;

[0140] The communication server synchronizes the messages sent by other gateways in the gateway group to the first gateway, and the communication server synchronizes the messages sent by the first gateway to other gateways in the gateway group.

[0141] In a possible implementation, the first gateway may also be used for:

[0142] The first gateway sends the successful execution message to the communication server;

[0143] The communication server sends the successful execution message to other gateways in the gateway group;

[0144] After receiving the successful execution message, other gateways mark the target task stored by themselves as the task completed state.

[0145] In a possible implementation, the system may further include:

[0146] The first gateway sends the task execution result to the platform server, and the task execution result is used to notify the platform server that the target task has been successfully executed.

[0147] In a possible implementation, the system may further include:

[0148] If the first gateway determines that it cannot execute the target task, the first gateway ignores the group creation instruction.

[0149] It should be noted that, for the information interaction, execution process, etc. between the above-mentioned devices / units, since they are based on the same concept as the method embodiments of the present application, for their specific functions and the technical effects brought about, reference can be specifically made to the method embodiment part, and details will not be elaborated here.

[0150] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiment, and details will not be elaborated here.

[0151] The embodiment of the present application also provides a gateway, see Figure 6 , the gateway 400 may include: at least one processor 410, a memory 420, and a computer program stored in the memory 420 and executable on the at least one processor 410. When the processor 410 executes the computer program, it implements the steps in any of the foregoing method embodiments, such as Figure 3 the steps S101 to S103 in the illustrated embodiment.

[0152] Exemplarily, the computer program can be divided into one or more modules / units. One or more modules / units are stored in the memory 420 and executed by the processor 410 to complete the present application. The one or more modules / units can be a series of computer program segments capable of performing specific functions, and these program segments are used to describe the execution process of the computer program in the gateway 400.

[0153] Those skilled in the art can understand that Figure 6 is only an example of the gateway and does not constitute a limitation on the gateway. It may include more or fewer components than shown in the figure, or combine some components, or different components, such as input / output devices, network access devices, buses, etc.

[0154] The processor 410 may be a Central Processing Unit (CPU), or may also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0155] The memory 420 may be an internal storage unit of the gateway or an external storage device of the gateway, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. The memory 420 is used to store the computer program and other programs and data required by the gateway. The memory 420 may also be used to temporarily store data that has been output or is to be output.

[0156] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the buses in the drawings of this application are not limited to only one bus or one type of bus.

[0157] The task processing method of the gateway provided by the embodiments of this application can be applied to gateways such as computers, tablet computers, laptop computers, netbooks, personal digital assistants (PDAs), etc. The embodiments of this application do not impose any restrictions on the specific type of the gateway.

[0158] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0159] Those of ordinary skill in the art will realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0160] In the embodiments provided in this application, it should be understood that the disclosed gateways, devices, and methods can be implemented in other ways. For example, the gateway embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

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

[0162] In addition, the functional units in each embodiment of this application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0163] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes of the above-mentioned method embodiments of this application, it can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by one or more processors, the steps of the above-mentioned method embodiments can be implemented.

[0164] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of this application, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by one or more processors, the steps of the above-described various method embodiments can be implemented.

[0165] Similarly, as a computer program product, when the computer program product runs on a terminal device, it enables the terminal device to implement the steps in the above-described various method embodiments when executed.

[0166] Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device that can carry the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0167] The above-described embodiments are only used to illustrate the technical solutions of this application, rather than to limit it; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of this application, and should all be included in the protection scope of this application.

Claims

1. A task processing method for a gateway, characterized in that, Applied to multiple gateways, the method includes: After the first gateway receives a group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction. The group creation instruction is generated by the platform server according to the target task to be executed and sent to at least one of the gateways. The first gateway is any one of the multiple gateways; If the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group; If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group. The successful execution information is used for the other gateways not to process the target task after receiving the successful execution information.

2. The task processing method of the gateway according to claim 1, wherein After the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes: If the first gateway does not execute the target task and the first gateway receives the successful execution information of the target task sent by the second gateway, the second gateway is the gateway in the gateway group that executes the target task; The first gateway marks the stored target task as the task completion status.

3. The task processing method of the gateway according to claim 1, characterized in that, After the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes: The first gateway sends a group creation success message to the platform server, where the group creation success message is used to instruct the platform server to store the gateway group and to instruct the platform server to send operation instructions of the target task to each gateway in the gateway group; Correspondingly, after the first gateway receives the operation instruction, the first gateway sends a connection message to the terminal device corresponding to the target task. The terminal device is the object to which the target task is executed. The connection message is used to instruct the terminal device to create a communication connection with the first gateway; After the first gateway and the terminal device successfully create a communication connection, the first gateway executes the target task.

4. The task processing method of the gateway according to any one of claims 1 to 3, characterized in that, After the first gateway creates a gateway group related to the target task and adds itself to the gateway group, the method further includes: The first gateway sends a message subscription notification to the communication server. The message subscription notification is used to instruct the communication server to synchronize messages sent by other gateways in the gateway group to the first gateway and to instruct the communication server to synchronize messages sent by the first gateway to other gateways in the gateway group.

5. The task processing method of the gateway according to claim 4, characterized in that, The first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group, including: The first gateway sends the successful execution message to the communication server, where the successful execution message is used to instruct the communication server to send the successful execution message to other gateways in the gateway group, and to instruct the other gateways to mark the target task stored by themselves as the task completion status after receiving the successful execution message.

6. The task processing method of the gateway according to claim 1, characterized in that, If the first gateway successfully executes the target task, the method further includes: The first gateway sends the task execution result to the platform server, and the task execution result is used to notify the platform server that the target task has been successfully executed.

7. The task processing method of the gateway according to claim 1, wherein, After the first gateway determines whether it can execute the target task in the group creation instruction, the method further includes: If the first gateway determines that it cannot execute the target task, the first gateway ignores the group creation instruction.

8. A task processing system for a gateway, characterized in that, Including: A platform server and multiple gateways; When the platform server determines the target task to be executed, the platform server generates a group creation instruction for the target task, and the platform server sends the group creation instruction to at least one gateway. After the first gateway receives the group creation instruction, the first gateway determines whether it can execute the target task in the group creation instruction, and the first gateway is any one of the multiple gateways. If the first gateway determines that it can execute the target task, the first gateway creates a gateway group related to the target task and adds itself to the gateway group. If the first gateway successfully executes the target task, the first gateway synchronizes the successful execution message of the target task to other gateways in the gateway group. The other gateways will no longer process the target task after receiving the successful execution information.

9. A gateway, characterized in that, For executing the task processing method of the gateway according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the task processing method of the gateway according to any one of claims 1 to 7.