Request processing method and device, electronic equipment and storage medium

By adopting a request processing method in the Internet of Things gateway, determining the priority of pending requests and limiting the number of requests in the execution state, the problem of burst traffic exceeding the network and processing capabilities is solved, and the effect of smoothing traffic and improving user experience is achieved.

CN120201091APending Publication Date: 2025-06-24BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311773787.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

In the field of IoT technology, when the smart device node is connected to the gateway, the burst traffic caused by the large state of the device node exceeds the upper limit of the network traffic and the upper limit of the gateway processing capacity, resulting in network failures and message retransmission, affecting the synchronization of the device node status and user experience.

Method used

A request processing method is provided to determine the priority of each request by creating pending requests for smart devices, and limit the number of pending requests in the execution state at the same time based on priority and preset execution rules to smooth out burst traffic and avoid network failures.

Benefits of technology

Smooth burst traffic by preset execution rules, avoid network failures, ensure the timeliness of pending requests with higher priority, improve the update speed of node status of smart device, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120201091A_ABST
    Figure CN120201091A_ABST
Patent Text Reader

Abstract

The invention relates to a request processing method and device, electronic equipment and a storage medium. The request processing method comprises the following steps: creating at least one to-be-processed request for at least one intelligent device; determining the priority of each to-be-processed request; and based on the priority and a preset execution rule, executing the at least one to-be-processed request to obtain a request result, the preset execution rule being used for limiting a first number, and the first number being the number of the to-be-processed requests in an execution state at the same moment. According to the method, the effect of smoothing the burst traffic can be achieved through the preset execution rule when the burst traffic exceeds the network traffic upper limit and the gateway equipment processing capability upper limit, network faults are avoided, meanwhile, the execution sequence is determined according to the priority of each to-be-processed request, the timeliness of the to-be-processed requests with the higher priority can be ensured, and the processing efficiency of the to-be-processed requests is improved. The updating speed of the node state of the intelligent device corresponding to the to-be-processed request with the high priority is increased, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet of Things technology, and in particular, to a request processing method, apparatus, electronic device, and storage medium. Background Art

[0002] In the field of Internet of Things technology, each intelligent device node is connected to a server through an Internet of Things gateway. To ensure the accuracy of the status of each device node, when each device node establishes a connection with the gateway, it needs to synchronize the device node status to the gateway. If there are many device node statuses, burst traffic will be generated at the gateway when establishing a connection. Especially when the gateway is powered on, the gateway needs to establish connections with all device nodes in a short time. At this time, the generated burst traffic will reach the upper limit of network traffic and the upper limit of gateway processing capacity, resulting in network failures, device node status synchronization failures, and then causing message retransmission, which increases the gateway load. Summary of the Invention

[0003] To overcome the problems existing in the related art, the present disclosure provides a request processing method, apparatus, electronic device, and storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, a request processing method is provided. The method includes:

[0005] Create at least one pending request for at least one intelligent device;

[0006] Determine the priority of each of the pending requests;

[0007] Based on the priority and a preset execution rule, execute the at least one pending request to obtain a request result. The preset execution rule is used to limit a first quantity, and the first quantity is the number of the pending requests in an execution state at the same time.

[0008] In an exemplary embodiment, each of the pending requests includes at least one of the following:

[0009] The identifier of the pending request, the type of the pending request, the creation time of the pending request, the parameters of the pending request, the status of the pending request, the callback function of the pending request;

[0010] Wherein, the callback function is used to obtain the request result of the pending request.

[0011] In an exemplary embodiment, the determining the priority of each of the pending requests includes:

[0012] Determine the priority of each of the pending requests according to the type of each of the pending requests.

[0013] In an exemplary embodiment, the method further includes:

[0014] If there are at least two of the pending requests with the same type, determine the priority of each of the at least two pending requests according to the creation time of each of the at least two pending requests.

[0015] In an exemplary embodiment, the status of the pending request includes at least one of the following: initial status, ready status, execution status, and completion status;

[0016] The method further includes at least one of the following:

[0017] After creating the pending request, set the pending request to be in the initial status;

[0018] Generate a key corresponding to the pending request, establish a secure session, and set the pending request to be in the ready status; wherein the key is used to encrypt and decrypt the interaction information with the smart device when executing the pending request;

[0019] Execute the pending request, and set the pending request to be in the execution status;

[0020] After the execution of the pending request ends, set the pending request to be in the completion status.

[0021] In an exemplary embodiment, before determining the priority of each of the pending requests, the method further includes:

[0022] Determine that each of the pending requests is in the ready status.

[0023] In an exemplary embodiment, the preset execution rule includes:

[0024] The second quantity is less than or equal to the first threshold, and the second quantity is the number of pending requests for all the smart devices in the execution status at the same time.

[0025] In an exemplary embodiment, based on the priority and the preset execution rule, executing the at least one pending request includes:

[0026] Based on the priority, select a target pending request from the at least one pending request, and switch the status of the target pending request to the execution status;

[0027] When the number of the target pending requests in the execution status increases to the first threshold, stop selecting the target pending request.

[0028] In an exemplary embodiment, the method further includes:

[0029] After the execution of the target pending request ends, switch the target pending request to a completed state;

[0030] When the number of the target pending requests in the execution state decreases to a second threshold, continue to select the target pending requests.

[0031] In an exemplary embodiment, the preset execution rule further includes:

[0032] A third quantity is less than or equal to a third threshold, where the third quantity is the number of pending requests for each of the intelligent devices in the execution state at the same moment.

[0033] According to a second aspect of the embodiments of the present disclosure, there is provided a request processing apparatus, the apparatus includes:

[0034] A creation module, configured to create at least one pending request for at least one intelligent device;

[0035] A determination module, configured to determine the priority of each of the pending requests;

[0036] An execution module, configured to execute the at least one pending request based on the priority and a preset execution rule to obtain a request result, where the preset execution rule is used to limit a first quantity, and the first quantity is the number of the pending requests in the execution state at the same moment.

[0037] According to a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:

[0038] A processor;

[0039] A memory for storing instructions executable by the processor;

[0040] Wherein, the processor is configured to execute the method described in the first aspect of the embodiments of the present disclosure.

[0041] According to a fourth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enabling the electronic device to execute the method described in the first aspect of the embodiments of the present disclosure.

[0042] Adopting the above method of the present disclosure has the following beneficial effects: By presetting the execution rules, when the burst traffic exceeds the network traffic upper limit and the gateway device processing capacity upper limit, the effect of smoothing the burst traffic can be achieved, avoiding network failures. At the same time, determining the execution order according to the priority of each request to be processed can ensure the timeliness of the requests to be processed with higher priorities, improve the update speed of the status of the intelligent device nodes corresponding to the requests to be processed with higher priorities, and enhance the user experience.

[0043] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.

[0045] Figure 1 is a flowchart of a request processing method shown according to an exemplary embodiment;

[0046] Figure 2 is a schematic diagram of a network topology shown according to an exemplary embodiment;

[0047] Figure 3 is a flowchart of a request processing method shown according to an exemplary embodiment;

[0048] Figure 4 is a schematic diagram of selecting a target request to be processed shown according to an exemplary embodiment;

[0049] Figure 5A is a schematic diagram of the request processing flow shown according to an exemplary embodiment;

[0050] Figure 5B is a schematic diagram of the status transition of requests to be processed shown according to an exemplary embodiment;

[0051] Figure 6 is a block diagram of a request processing device shown according to an exemplary embodiment;

[0052] Figure 7 is a block diagram of an electronic device shown according to an exemplary embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0053] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers 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 the present disclosure. On the contrary, they are merely examples of apparatuses and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0054] In some embodiments, to avoid network failures caused by burst traffic exceeding the network traffic limit and the gateway processing capacity limit, a connection window is set at the gateway. By dispersing the messages used by each device node to synchronize the device node status through the connection window, burst traffic is smoothed. However, when there are a large number of device node statuses, the gateway cannot synchronize the statuses of all device nodes simultaneously through the connection window. Therefore, it is necessary to synchronize the device node statuses in multiple times. Moreover, since the gateway processes messages in a first-come-first-served manner, in the case of large traffic, for messages that arrive later in time, the long waiting time will affect the timeliness of the messages, resulting in a slow update of the device node status and seriously affecting the user experience.

[0055] In an exemplary embodiment of the present disclosure, to overcome the network failures caused by burst traffic exceeding the network traffic limit and the gateway processing capacity limit in the related art, a request processing method is provided, including: creating at least one pending request for at least one intelligent device; determining the priority of each pending request; and based on the priority and a preset execution rule, executing at least one pending request to obtain a request result. The preset execution rule is used to limit a first quantity, and the first quantity is the number of pending requests in an execution state at the same moment. This method can achieve the effect of smoothing burst traffic when burst traffic exceeds the network traffic limit and the gateway device processing capacity limit through the preset execution rule, avoid network failures, and at the same time determine the execution order according to the priority of each pending request, which can ensure the timeliness of the pending requests with higher priorities, improve the update speed of the intelligent device node status corresponding to the pending requests with higher priorities, and enhance the user experience.

[0056] In an exemplary embodiment of the present disclosure, a request processing method is provided, Figure 1 is a flowchart of a request processing method shown according to an exemplary embodiment, as Figure 1 shown, including the following steps:

[0057] Step S101, creating at least one pending request for at least one intelligent device;

[0058] Step S102, determining the priority of each pending request;

[0059] Step S103: Based on the priority and a preset execution rule, execute at least one pending request to obtain a request result. The preset execution rule is used to limit a first quantity, where the first quantity is the number of pending requests in an execution state at the same moment.

[0060] The request processing method in the embodiments of the present disclosure is applied to a gateway device. The gateway device represents a protocol converter in the Internet of Things that supports a local area network connection protocol, including a gateway, a router, etc. For example, when the local area network connection protocol in the Internet of Things is the Matter protocol, the gateway device is a Matter gateway. A smart device represents an electronic device in the Internet of Things that supports a local area network connection protocol, including electronic devices in various Internet of Things smart scenarios, such as electronic devices in a smart home scenario like a smart switch, a smart light, a smart air conditioner, a smart TV, or electronic devices in a smart transportation scenario like a smart car head unit, a smart traffic light. In an example, Figure 2 is a schematic diagram of a network topology shown according to an exemplary embodiment, as Figure 2 shown, the gateway device is connected to multiple smart devices and the cloud, and is used to synchronize the status of each smart device node to the cloud or send messages from the cloud to the smart devices.

[0061] In step S101, the gateway device obtains a list of smart devices. For example, it obtains the list of smart devices to be connected from a server, or obtains the list of connected smart devices from a local database. Each smart device corresponds to unique identification information, such as node id information. A pending request represents a request for updating the status of a device node, including a subscription request, a read request, a write request, a control request, etc. sent by the gateway device to the smart device. The pending request can be created by the gateway device according to requirements. For example, when a smart device connects to the gateway device, the gateway device needs to subscribe to all attributes and events of the smart device to know the status of the smart device. At this time, the gateway device creates a subscription request by itself. The pending request can be created according to a user operation. For example, when the user controls to turn on the smart light, the user issues an instruction to turn on the smart light through a management device connected to the gateway device, and then the gateway device creates a control request to turn on the smart light. Each pending request corresponds to a smart device, and the corresponding smart device is determined according to the unique identification information of the smart device. The number of pending requests is determined according to the actual requests. The more smart devices the gateway device is connected to, the more the number of pending requests will be.

[0062] In step S102, the priority of the pending request to be processed is determined according to a preset rule. In one example, the timeliness requirement of the pending request generated by direct user interaction is relatively high. For example, when the user controls the change of the state of the intelligent device and expects the state of the intelligent device to change within the shortest possible time after issuing the control instruction, the timeliness requirement of the control request is relatively high, and then the gateway device needs to process it first. Therefore, the preset rule includes: the priority of the pending request generated by direct user interaction is higher than that of other pending requests. For another example, for an intelligent device that needs to display in real time, such as an intelligent thermometer, the timeliness requirement for real-time status update is relatively high. Then the preset rule includes: the priority of the pending request related to the important status in the intelligent device is higher than that of other pending requests. After determining the priority of each pending request, all pending requests are arranged in the order of priority, so that when the pending requests are executed subsequently, they can be taken out in the order of priority. For example, they can be arranged in the form of an array or a queue, or in the form of a red-black tree. The priority is from high to low, which is the left subtree, the root node, and the right subtree in turn.

[0063] In step S103, executing the pending request means the process of interacting with the intelligent device to synchronize the state of the intelligent device. When the pending request is being executed, it is in the execution state. The first quantity is the number of pending requests in the execution state at the same moment, that is, the number of pending requests executed simultaneously. The pending requests therein can be for all intelligent devices or for a single intelligent device. By restricting the number of pending requests executed by the gateway device at the same moment through a preset execution rule, it is possible to avoid network failures caused by exceeding the processing capacity limit of the gateway device or the idle of gateway device resources. At the same time, according to the priority of the pending request, the execution order of the pending request is determined under the condition of limited execution resources, which can ensure that the pending request with higher timeliness is processed first.

[0064] In an exemplary embodiment of the present disclosure, after the gateway device creates at least one pending request for at least one intelligent device, it determines the priority of each pending request, and based on the priority and the preset execution rule, executes at least one pending request to obtain a request result. By restricting the number of pending requests in the execution state at the same moment through the preset execution rule, it is possible to achieve the effect of smoothing the burst traffic when the burst traffic exceeds the network traffic limit and the processing capacity limit of the gateway device, avoiding network failures. At the same time, determining the execution order according to the priority of each pending request can ensure the timeliness of the pending request with higher priority, improve the update speed of the intelligent device node state corresponding to the pending request with higher priority, and enhance the user experience. In addition, the creation process and the execution process of the pending request are executed independently, which can reduce the total time consumption of the pending request processing process to a certain extent.

[0065] In an exemplary embodiment of the present disclosure, a request processing method is provided. Figure 3 It is a flowchart of a request processing method shown according to an exemplary embodiment, as Figure 3 shown, and includes the following steps:

[0066] Step S301, create at least one pending request for at least one intelligent device;

[0067] Step S302, determine that each pending request is in a ready state;

[0068] Step S303, determine the priority of each pending request according to the type of each pending request;

[0069] Step S304, if there are at least two pending requests of the same type, determine the priority of each of the at least two pending requests according to the creation time of each pending request among the at least two pending requests;

[0070] Step S305, based on the priority, select a target pending request from at least one pending request, and switch the status of the target pending request to an execution state;

[0071] Step S306, when the number of target pending requests in the execution state increases to a first threshold, stop selecting the target pending request;

[0072] Step S307, after the execution of the target pending request ends, obtain a request result, and switch the target pending request to a completed state;

[0073] Step S308, when the number of target pending requests in the execution state decreases to a second threshold, continue to select the target pending request.

[0074] In step S301, for the specific implementation manner, refer to step S101. In some possible implementation manners, each pending request includes at least one of the following: the identifier of the pending request, the type of the pending request, the creation time of the pending request, the parameters of the pending request, the status of the pending request, the callback function of the pending request; wherein, the callback function is used to obtain the request result of the pending request.

[0075] The identifier of the request to be processed is a symbolic feature that can uniquely represent a certain request to be processed. For example, it is represented by a request ID. When creating a request to be processed, a unique ID is assigned to the request to be processed. The generation method of the request ID is not limited in this disclosure. For example, the IDs of each request to be processed are generated sequentially in an incremental manner: 001, 002, 003, etc. The type of the request to be processed is determined according to the local area network connection protocol used. For example, in the Matter protocol, the type of the request to be processed is divided into five types according to the type of the interaction message: control invoke request, write request, read request, subscribe request, and remove subscribe request. The creation time of the request to be processed is determined according to the actual creation time. The parameters of the request to be processed represent the parameters carried by the message. For example, the parameters carried when a user controls an intelligent air conditioner include the air conditioner temperature. The status of the request to be processed is determined according to the different stages in which the request to be processed is located. The callback function of the request to be processed is used to obtain the request result of the request to be processed. For example, the gateway device creates a request to be processed through the service layer and executes the request to be processed through the execution layer. The callback function is used to return the execution result of the execution layer to the service layer. The request result can be that the request is executed successfully, or the request times out or the request fails due to the disconnection of the intelligent device.

[0076] In some possible implementation manners, the status of the request to be processed includes at least one of the following: initial status, ready status, execution status, and completion status.

[0077] Then the above method further includes at least one of the following:

[0078] After creating the request to be processed, set the request to be processed in the initial status;

[0079] Generate a key corresponding to the request to be processed, establish a secure session, and set the request to be processed in the ready status; wherein, the key is used to encrypt and decrypt the interaction information with the intelligent device when executing the request to be processed;

[0080] Execute the request to be processed and set the request to be processed in the execution status;

[0081] After the execution of the request to be processed ends, set the request to be processed in the completion status.

[0082] Set different statuses according to different stages of the pending request. After successfully creating a pending request, set the pending request to the initial status. The process of executing a pending request requires information interaction with an intelligent device. To ensure the security of the interaction information, encrypt and decrypt the interaction information through keys. The encryption key and the decryption key can be the same or different. Each pending request corresponds to a key or a pair of keys. Generate the key corresponding to the pending request, complete the key exchange between the gateway device and the intelligent device, and successfully establish a secure session. Then switch from the initial status to the ready status. At this time, set the pending request to the ready status. In the ready status, when starting to execute the pending request, that is, when the pending request is being processed, switch from the ready status to the execution status and set the pending request to the execution status. After the execution of the pending request ends, indicating that the pending request has been processed, switch from the execution status to the completed status and set the pending request to the completed status.

[0083] In step S302, to ensure the security of the interaction information, generate the key of the pending request, establish a secure session to encrypt and decrypt the interaction information, and then execute the pending request. Therefore, it is necessary to determine that each pending request is in the ready status, that is, a secure session is successfully established.

[0084] In step S303, the timeliness requirements of different types of pending requests are different, and the priorities of different types of pending requests are preset values. For example, in the Matter protocol, invoke requests and write requests are usually created based on user control operations and have higher timeliness requirements. The timeliness requirement of read requests is higher than that of remove subscribe requests and subscribe requests. Therefore, the priority order of different types of pending requests is: invoke request > write request > read request > remove subscribe request > subscribe request, which can respond to user control operations in a timely manner, thus ensuring the control experience of users controlling intelligent devices.

[0085] In step S304, when it is necessary to distinguish the priority order among pending requests of the same type, determine the priority of the pending request according to the creation time of the pending request. Since the waiting time of the pending request with an earlier creation time is longer, to ensure timeliness and avoid too long waiting time, the priority of the pending request with an earlier creation time is higher than that of the pending request with a later creation time.

[0086] In steps S305 - S306, the preset execution rule includes: the second quantity is less than or equal to the first threshold, where the second quantity is the number of pending requests for all intelligent devices in the execution state at the same moment. The first threshold is determined by the upper limit of the processing capacity of the gateway device. For example, the first threshold is 10. The second quantity represents the number of pending requests for all intelligent devices in the execution state at the same moment, that is, the total number of all pending requests in the execution state. The total number of pending requests in the execution state being less than or equal to the first threshold can avoid network failures caused by exceeding the upper limit of the processing capacity of the gateway device.

[0087] The target pending request represents the pending request with the highest priority among the pending requests in the ready state. The selected target pending request is switched to the execution state, that is, the target pending request starts to be executed. The number of target pending requests in the execution state is the number of pending requests for all intelligent devices in the execution state at the same moment. When the number of target pending requests in the execution state increases to the first threshold, it indicates that the upper limit of the processing capacity of the gateway device has been reached, and at this time, the selection of the target pending request stops.

[0088] In steps S307 - S308, after the execution of the target pending request ends, the target pending request is switched to the completed state. At this time, the number of target pending requests in the execution state continuously decreases. To avoid the number of target pending requests in the execution state oscillating back and forth near the first threshold, that is, the upper limit of the processing capacity, which affects the request processing performance of the gateway device, when the number of target pending requests in the execution state decreases to the second threshold, it indicates that the request processing resources of the gateway device are sufficient, and then the target pending request is selected again. Here, the second threshold is an empirical value determined according to the lower limit of the processing capacity of the gateway device. For example, when the first threshold is 10, the second threshold is 3.

[0089] In one example, Figure 4 is a schematic diagram of selecting a target pending request shown according to an exemplary embodiment, as Figure 4As shown, the horizontal axis represents the number of target requests to be processed in the execution state, and the vertical axis represents whether a target request to be processed can be selected. When the number of target requests to be processed in the execution state is 0, a target request to be processed is selected and switched to the execution state. Along the direction of the first arrow, the number of target requests to be processed in the execution state continuously increases, and during this process, target requests to be processed can be selected until the first threshold is reached; wait for the target requests to be processed to be executed in sequence. Along the direction of the third arrow, the number of target requests to be processed in the execution state continuously decreases, and during this process, target requests to be processed cannot be selected until the second threshold is reached; along the direction of the third arrow, the number of target requests to be processed in the execution state decreases to less than the second threshold, and during this process, target requests to be processed can be selected.

[0090] In some possible implementation manners, the preset execution rule further includes: a third quantity is less than or equal to a third threshold, and the third quantity is the number of requests to be processed for each intelligent device in the execution state at the same moment.

[0091] The third threshold is determined according to the processing capacity upper limit of each intelligent device. For example, the third threshold of an intelligent device is 1, indicating that the intelligent device can only execute one request to be processed at the same moment. The processing capacity upper limits of each intelligent device can be the same or different. When selecting a target request to be processed, the third quantity limit is taken into account. For example, when the target requests to be processed in the execution state include request 1 corresponding to device 1 and do not include the request corresponding to device 2, if the highest-priority request to be processed in the ready state is request 2 corresponding to device 1 and the second-highest priority is request 3 corresponding to device 2, at this time, in order to ensure that the third quantity is less than or equal to the third threshold 1, the selected target request to be processed is request 3 corresponding to device 2. In this implementation manner, while considering the request processing capacity of the gateway device, the processing capacity upper limit of each intelligent device is taken into account, which can avoid the problem of request processing timeout caused by exceeding the processing capacity upper limit of the intelligent device.

[0092] In one example, Figure 5A is a schematic flowchart of request processing shown according to an exemplary embodiment. As Figure 5A shown, a red-black tree is used to sort the requests to be processed in the request queue in the order of priority. The request data structure of each request to be processed includes a request ID, a request type, a creation time, request parameters, and a callback function. The request selection unit selects a target request to be processed from the request queue according to the preset execution rule and adds it to the execution queue. The requests in the execution queue are all requests being processed. When the requests in the execution queue are completed, they are removed from the request queue.

[0093] In one example, on the basis of Figure 5A ​Figure 5B It is a schematic diagram of the status transition of a request to be processed shown according to an exemplary embodiment. As Figure 5B shown, the request to be processed is successfully created, and the request to be processed is in the initial state; a key corresponding to the request to be processed is generated, and the secure session is successfully established. The request to be processed is switched from the initial state to the ready state; it is arranged in the request queue in the order of priority, selected by the request selection unit, determined to be the target request to be processed, and switched from the ready state to the execution state, selected from the request queue and added to the execution queue; when the target request to be processed is completed, it is switched from the execution state to the completed state; when in the completed state, the callback function is executed to obtain the request result and removed from the execution queue. In addition, when in the initial state, if the request times out or the smart device corresponding to the request is disconnected, it is directly switched from the initial state to the completed state. When in the ready state, if the secure session is disconnected, the request to be processed is directly switched from the ready state to the completed state and removed from the request queue. Therefore, the request result obtained by the callback function in the completed state can be that the request execution is completed, or it can be that the request fails due to request timeout, smart device disconnection, or secure session disconnection.

[0094] In an exemplary embodiment of the present disclosure, a request processing device is provided. Figure 6 It is a block diagram of a request processing device shown according to an exemplary embodiment. As Figure 6 shown, it includes:

[0095] A creation module 601, configured to create at least one request to be processed for at least one smart device;

[0096] A determination module 602, configured to determine the priority of each request to be processed;

[0097] An execution module 603, configured to execute at least one request to be processed based on the priority and a preset execution rule, and obtain a request result. The preset execution rule is used to limit the first quantity, and the first quantity is the number of requests to be processed in the execution state at the same time.

[0098] In an exemplary embodiment, each request to be processed includes at least one of the following:

[0099] The identifier of the request to be processed, the type of the request to be processed, the creation time of the request to be processed, the parameters of the request to be processed, the status of the request to be processed, the callback function of the request to be processed;

[0100] Among them, the callback function is used to obtain the request result of the request to be processed.

[0101] In an exemplary embodiment, the determination module 602 is further configured to:

[0102] Determine the priority of each pending request according to the type of each pending request.

[0103] In one exemplary embodiment, the determining module 602 is further configured to:

[0104] If there are at least two pending requests of the same type, determine the priority of each of the at least two pending requests according to the creation time of each of the at least two pending requests.

[0105] In one exemplary embodiment, the status of the pending request includes at least one of the following: initial status, ready status, execution status, and completion status;

[0106] The execution module 603 is further configured to at least one of the following:

[0107] After creating a pending request, set the pending request to the initial status;

[0108] Generate a key corresponding to the pending request, establish a secure session, and set the pending request to the ready status; wherein, the key is used to encrypt and decrypt the interaction information with the smart device when executing the pending request;

[0109] Execute the pending request and set the pending request to the execution status;

[0110] After the execution of the pending request ends, set the pending request to the completion status.

[0111] In one exemplary embodiment, before determining the priority of each pending request, the determining module 602 is further configured to:

[0112] Determine that each pending request is in the ready status.

[0113] In one exemplary embodiment, the preset execution rules include:

[0114] The second quantity is less than or equal to the first threshold, and the second quantity is the number of pending requests for all smart devices in the execution status at the same time.

[0115] In one exemplary embodiment, the execution module 603 is further configured to:

[0116] Based on the priority, select a target pending request from at least one pending request and switch the status of the target pending request to the execution status;

[0117] When the number of target pending requests in the execution status increases to the first threshold, stop selecting the target pending request.

[0118] In one exemplary embodiment, the execution module 603 is further configured to:

[0119] After the execution of the target pending request ends, the target pending request is switched to the completed state;

[0120] When the number of target pending requests in the execution state decreases to the second threshold, continue to select the target pending request.

[0121] In one exemplary embodiment, the preset execution rule further includes:

[0122] The third quantity is less than or equal to the third threshold, and the third quantity is the number of pending requests for each intelligent device in the execution state at the same moment.

[0123] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and will not be elaborated here.

[0124] Figure 7 It is a block diagram of an electronic device 700 shown according to an exemplary embodiment.

[0125] Referring to Figure 7 , the electronic device 700 may include one or more of the following components: a processing component 702, a memory 704, a power supply component 706, a multimedia component 708, an audio component 710, an input / output (I / O) interface 712, a sensor component 714, and a communication component 716.

[0126] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, telephone call, data communication, camera operation, and recording operation. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.

[0127] The memory 704 is configured to store various types of data to support the operation of the electronic device 700. Examples of these data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.

[0128] The power supply component 706 provides power for various components of the electronic device 700. The power supply component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 700.

[0129] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions, but also detect the duration and pressure associated with the touch or swipe operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.

[0130] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 704 or transmitted via the communication component 716. In some embodiments, the audio component 710 further includes a speaker for outputting audio signals.

[0131] The I / O interface 712 provides an interface between the processing component 702 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power-on button, and a lock button.

[0132] The sensor assembly 714 includes one or more sensors for providing an assessment of the status of various aspects of the electronic device 700. For example, the sensor assembly 714 can detect the on / off state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700. The sensor assembly 714 can also detect a change in the position of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and a change in the temperature of the electronic device 700. The sensor assembly 714 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0133] The communication component 716 is configured to facilitate communication between the electronic device 700 and other devices in a wired or wireless manner. The electronic device 700 can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0134] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described methods.

[0135] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 704 including instructions, is also provided. The above instructions can be executed by the processor 720 of the electronic device 700 to complete the above-described methods. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0136] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute a request processing method, and the method includes any of the above methods.

[0137] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure, which follow the general principles of the present disclosure and include well-known common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and examples are only to be considered as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.

[0138] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.

Claims

1. A request processing method, characterized in that, The method includes: Creating at least one pending request for at least one intelligent device; Determining the priority of each of the pending requests; Based on the priority and a preset execution rule, executing the at least one pending request to obtain a request result, where the preset execution rule is used to limit a first quantity, and the first quantity is the number of the pending requests in an execution state at the same moment.

2. The request processing method according to claim 1, characterized in that Each of the pending requests includes at least one of the following: The identifier of the pending request, the type of the pending request, the creation time of the pending request, the parameters of the pending request, the status of the pending request, the callback function of the pending request; Wherein, the callback function is used to obtain the request result of the pending request.

3. The request processing method according to claim 2, wherein The determining the priority of each of the pending requests includes: Determining the priority of each of the pending requests according to the type of each of the pending requests.

4. The request processing method according to claim 3, wherein The method further includes: If there are at least two pending requests with the same type, determining the priority of each of the at least two pending requests according to the creation time of each of the at least two pending requests.

5. The request processing method according to claim 2, wherein The status of the pending request includes at least one of the following: initial state, ready state, execution state, completed state; The method further includes at least one of the following: After creating the pending request, setting the pending request to be in the initial state; Generating a key corresponding to the pending request, establishing a secure session, and setting the pending request to be in the ready state; wherein, the key is used to encrypt and decrypt the interaction information with the intelligent device when executing the pending request; Executing the pending request and setting the pending request to be in the execution state; After the execution of the pending request ends, setting the pending request to be in the completed state.

6. The request processing method according to claim 5, characterized in that, Before determining the priority of each of the pending requests, the method further includes: Determining that each of the pending requests is in the ready state.

7. The request processing method according to claim 1, wherein The preset execution rule includes: A second quantity is less than or equal to a first threshold, and the second quantity is the number of the pending requests for all the intelligent devices in the execution state at the same moment.

8. The request processing method according to claim 7, characterized in that, The executing the at least one pending request based on the priority and the preset execution rule includes: Based on the priority, selecting a target pending request from the at least one pending request and switching the status of the target pending request to the execution state; When the number of the target pending requests in the execution state increases to the first threshold, stopping selecting the target pending request.

9. The request processing method according to claim 8, characterized in that, The method further includes: After the execution of the target pending request ends, switching the target pending request to the completed state; When the number of the target pending requests in the execution state decreases to a second threshold, continuing to select the target pending request.

10. The request processing method according to claim 7, wherein The preset execution rule further includes: A third quantity is less than or equal to a third threshold, and the third quantity is the number of the pending requests for each intelligent device in the execution state at the same moment.

11. A request processing device, characterized in that, The device includes: a creation module configured to create at least one pending request for at least one smart device; a determination module configured to determine the priority of each of the pending requests; an execution module configured to execute the at least one pending request based on the priority and a preset execution rule to obtain a request result, the preset execution rule being used to limit a first quantity, the first quantity being the quantity of the pending requests in an execution state at the same moment.

12. An electronic device, characterized in that, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to execute the method according to any one of claims 1-10.

13. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method according to any one of claims 1-10.