Message processing method, gateway, system and electronic equipment
By introducing reference information into the gateway as a priority decision dimension, a dynamic configuration mechanism is built, which solves the problem that the gateway cannot dynamically adjust priorities in different scenarios, realizes differentiated configuration and flexible adaptation, and improves the gateway's adaptability and offline availability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU HEMI TECHNOLOGY CO LTD
- Filing Date
- 2026-03-17
- Publication Date
- 2026-05-15
AI Technical Summary
In existing technologies, gateways cannot dynamically adjust priorities based on usage scenarios when processing device messages. They do not take into account real-time changes in user/device/environment status, making it difficult to adapt to the differentiated needs of different households. Furthermore, they cannot schedule properly when the network is down, resulting in a mismatch between priorities and actual needs, delayed operation and maintenance response, and security risks.
By introducing reference information as a priority decision dimension, a dynamic priority configuration mechanism with "message + reference information" is constructed. The gateway can quickly find the target configuration rule through a pre-stored configuration rule library, dynamically determine the processing priority of the message, and adapt to the ever-changing actual application needs.
It enables differentiated priority configuration of the gateway in different scenarios, adapts to changing actual needs, improves the gateway's adaptability and offline availability, and reduces the complexity of rule configuration and operation and maintenance costs.
Smart Images

Figure CN122053522A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of intelligent control technology, and more specifically, to a message processing method, gateway, system, and electronic device. Background Technology
[0002] With the development of smart home and Internet of Things technologies, gateways, as the central hub of devices (such as security sensors, environmental monitoring equipment, and smart control devices), need to process a large number of messages from devices (including alarm information, status data, and fault feedback).
[0003] To ensure that critical messages are responded to with priority, existing technologies generally adopt a static priority message hierarchy scheme. This involves pre-setting fixed priorities for device types or message types, and the gateway determines the scheduling order based on the priority of each message. However, the static priority scheme has significant limitations: it cannot achieve differentiated configurations and lacks adaptability to different practical needs. Summary of the Invention
[0004] This disclosure provides a message processing method, gateway, system, and electronic device, which can solve the above-mentioned problems of the prior art. The technical solution is as follows: According to one aspect of the embodiments of this disclosure, a message processing method is provided, applied to a gateway, the method comprising: Obtain the target message reported by the target device in the device set, wherein the message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device; Obtain the reference information at the current moment and use it as the target reference information; Retrieve target configuration rules that match the target message and target reference information from the pre-stored configuration rule base. Each configuration rule in the configuration rule base indicates the mapping relationship between the message, reference information and priority. The target message is processed using the priority indicated by the target configuration rule as the target priority.
[0005] In one possible implementation, the reference information includes at least one of scenario information and status information. The scenario information indicates the business scenario of the gateway, and the status information is used to indicate at least one of the user's activity status, the device's operating status, and the environment's security status. The configuration rule base includes multiple first configuration rules, each of which is used to indicate the mapping relationship between at least one of the scenario information and status information, messages, and priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Find the first configuration rule in the configuration rule base that matches the target message and every item in the target reference information; If a first configuration rule exists in the configuration rule base that matches the target message and every item in the target reference information, then the first configuration rule that matches the target message and every item in the target reference information will be used as the target configuration rule.
[0006] In one possible implementation, where the target reference information includes target scene information and target state information, the method further includes: If there is no first configuration rule in the configuration rule base that matches the target message and matches each item in the target reference information, then the first configuration rule that matches the target message and matches one of the target scenario information and the target status information is obtained as the reference configuration rule. Based on the priority of each reference configuration rule, obtain the target priority corresponding to the target message.
[0007] In one possible implementation, the reference information includes at least one of scenario information and state information, and the configuration rule base includes multiple second configuration rules and multiple third configuration rules. The second configuration rules include the mapping relationship between messages and basic priorities, and the third configuration rules include the mapping relationship between at least one of scenario information and state information and the change amount of basic priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Determine the target second configuration rule that matches the message from the configuration rule base, and obtain the target basic priority corresponding to the target second configuration rule; Determine the target third configuration rule that matches each item in the target reference information from the configuration rule base, and obtain the target change amount corresponding to the target third configuration rule; Adjust the basic priority of the target based on the change in the target, and obtain the target priority.
[0008] In one possible implementation, processing the target message includes: The target message is added to the message queue corresponding to the target priority. The message queue stores all messages of the corresponding priority in the order they are stored. Consume messages from each queue in descending order of priority. For each message queue, perform consumption operations on the message queue, including: The messages in the message queue are processed sequentially until the consumption time of the message queue currently being consumed reaches the preset time, at which point the message queue for the next consumption operation is determined. If the message queue currently being consumed does not correspond to the lowest priority, then the message queue with the next lower priority will be used as the message queue for the next consumption operation. If the message queue currently being consumed corresponds to the lowest priority, then the message queue with the highest priority will be used as the message queue for the next consumption operation.
[0009] In one possible implementation, when the target priority corresponds to the highest priority, the message queues are consumed sequentially, including: If the message queue currently being consumed is not the message queue corresponding to the target priority, pause processing of messages in the message queue currently being consumed; Messages are processed sequentially according to the order of messages in the message queue corresponding to the target priority, until all messages in the message queue corresponding to the target priority have been processed, then processing of messages in the currently consumed message queue resumes.
[0010] In one possible implementation, processing the target message includes at least one of the following: Send a notification message to the user terminal, which includes real-time monitoring data of the target device reported by the target device; Send an acknowledgment frame to the target device. The acknowledgment frame is used to confirm whether the monitoring data reported by the target device is accurate. The system receives a response frame from the target device in response to the acknowledgment frame. If the monitoring data is confirmed to be accurate based on the response frame, the system obtains and stores the relevant information for processing the target message as a log. The relevant information includes the monitoring data, the target priority, and the processing time of the target message.
[0011] According to another aspect of the present disclosure, a gateway is provided, comprising: The message acquisition module is used to acquire target messages reported by target devices in the device set. The message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device. The information acquisition module is used to acquire reference information at the current moment and use it as target reference information; The priority configuration module is used to retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base. Each configuration rule in the configuration rule base indicates the mapping relationship between the message, reference information and priority. The message processing module is used to process target messages by taking the priority indicated by the target configuration rules as the target priority.
[0012] According to another aspect of the present disclosure, a message processing system is provided, including a gateway and at least one device, wherein the gateway, when executing, implements the steps of the message processing method described above.
[0013] According to another aspect of the present disclosure, an electronic device is provided, the electronic device including a memory, a processor, and a computer program stored in the memory, the processor executing the computer program to implement the above-described method.
[0014] According to another aspect of the present disclosure, a computer-readable storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the above-described method.
[0015] According to one aspect of the present disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described method.
[0016] The beneficial effects of the technical solutions provided in this disclosure are: By introducing reference information independent of the message as one of the priority decision dimensions, a two-dimensional dynamic priority configuration mechanism of "message + reference information" is constructed. A configuration rule base is pre-stored in the gateway. Each configuration rule in the configuration rule base indicates the mapping relationship between message, reference information and priority. This allows the gateway to quickly find the target configuration rule that matches the target message and target reference information directly from the pre-set configuration rule base and obtain the target priority for processing the target message. This enables the gateway to dynamically determine the processing priority that the same message should have under different circumstances based on the current actual situation reflected by the reference information, realize differentiated configuration of priority strategy, and adapt to the ever-changing actual application needs. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments of this disclosure will be briefly introduced below.
[0018] Figure 1 A flowchart illustrating a message processing method provided in an embodiment of this disclosure; Figure 2 A flowchart illustrating a differentiated message processing method provided in an embodiment of this disclosure; Figure 3 This is a schematic flowchart of a method for processing a target message provided in an embodiment of the present disclosure; Figure 4 A flowchart illustrating a reference information acquisition method provided in an embodiment of this disclosure; Figure 5 This is a schematic diagram of the structure of a gateway provided in an embodiment of the present disclosure; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0019] The embodiments of this disclosure are described below with reference to the accompanying drawings. It should be understood that the embodiments described below with reference to the accompanying drawings are exemplary descriptions for explaining the technical solutions of the embodiments of this disclosure, and do not constitute a limitation on the technical solutions of the embodiments of this disclosure.
[0020] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the terms “comprising” and “including” as used in embodiments of this disclosure mean that the corresponding feature can be implemented as the presented feature, information, data, step, operation, element, and / or component, but do not exclude implementation as other features, information, data, step, operation, element, component, and / or combinations thereof supported by the art. It should be understood that when we say that an element is “connected” or “coupled” to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element are connected through an intermediate element. Furthermore, “connected” or “coupled” as used herein can include wireless connection or wireless coupling. The term “and / or” as used herein indicates at least one of the items defined by the term; for example, “A and / or B” can be implemented as “A,” or as “B,” or as “A and B.”
[0021] To make the objectives, technical solutions, and advantages of this disclosure clearer, the embodiments of this disclosure will be described in further detail below with reference to the accompanying drawings.
[0022] The following description of several exemplary embodiments illustrates the technical solutions of this disclosure and the technical effects produced by these solutions. It should be noted that the following embodiments can be referenced, learned from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0023] The relevant technologies involved in this application are described below: A gateway, also known as an internetwork connector or protocol converter, is a crucial device or software module for interconnecting different networks or systems. In the field of intelligent control technology, the gateway is the core control device of a smart home control system, responsible for unifying the access and control of different communication protocols (such as Wi-Fi, Zigbee, Bluetooth, etc.) and enabling collaborative operation between smart home devices through cloud or local processing.
[0024] Smart home devices refer to home products that are connected via Internet of Things (IoT) technology and possess intelligent functions. These devices have built-in sensors, processors, and network communication modules, enabling them to sense their environment, collect data, make autonomous decisions, and execute actions.
[0025] In this disclosure, "device" refers to a smart home device, or a sub-device or module within a smart home device (a smart home device can integrate multiple sub-devices or modules), such as: security sensors, environmental monitoring devices, water immersion sensors, and door magnetic sensors in smart refrigerators used to detect whether the door is closed, etc.
[0026] Existing technologies generally adopt a static priority leveling scheme, that is, a fixed priority is set in advance for the type of device or the type of message, and the gateway determines the scheduling and processing order according to the priority of each message.
[0027] More specifically, the main implementation methods of static priority scheduling include: 1. Fixed priority based on equipment type: For example, set gas sensor and smoke sensor reports as high priority, and temperature and humidity sensor reports as low priority. 2. Fixed priority based on the reported message type: For example, set fault alarms as high priority and timed status reports as low priority. 3. Supports users to manually adjust the priority of a single device, but the adjustment logic is isolated and not related to the scene or device / user status.
[0028] While the above control method can assign different priorities to messages reported by the device, it has the following problems: 1. Poor scenario adaptability: Static priorities cannot be dynamically adjusted according to usage scenarios. For example, the environmental comfort requirements when users are sleeping are higher than those when they are out on weekdays. The processing priorities of messages reported by the same temperature and humidity sensor are different, but the existing technology does not distinguish between these scenario differences, resulting in the priority of the same message not matching the actual needs.
[0029] 2. Lack of status awareness: The system does not adjust priorities based on real-time changes in user activity status (e.g., at home / outside / sleeping), device operating status (e.g., low battery / fault), and environmental safety status (e.g., emergency / normal). For example, when a device has low battery, it should be reminded to replace the battery first, but the static solution still handles it according to the original priority, resulting in a delay in maintenance response.
[0030] 3. Lack of personalization: Static rules assign fixed priorities to messages, which cannot adapt to the differentiated needs of different families (such as elderly families who require higher priority for health device reporting than ordinary families), and users have limited customization capabilities.
[0031] 4. Untimely response in emergency scenarios: Static rules do not take into account the urgency of the combination of "scenario + state". For example, in business trip mode, the message reported by the device indicating abnormality of doors and windows is more important than the same message reported in home mode, but the existing technology does not dynamically increase the priority, which poses a security risk.
[0032] 5. Reliance on cloud computing: Some solutions require uploading reported messages to the cloud for priority determination. In the absence of network access, it is impossible to schedule and assign priorities to messages normally, which affects the offline availability of the gateway.
[0033] Therefore, current commonly used message processing methods suffer from several technical problems: they cannot dynamically adjust priorities according to usage scenarios, they do not consider real-time changes in user / device / environment status, they are difficult to adapt to the differentiated needs of different households, the urgency of the "scenario + status" combination, and they cannot be properly scheduled during network outages. These issues lead to a mismatch between priorities and actual needs, delayed maintenance response, and security risks. This disclosure provides a message processing method to address these technical problems to some extent.
[0034] The following description of several exemplary embodiments illustrates the technical solutions of this disclosure and the technical effects produced by these solutions. It should be noted that the following embodiments can be referenced, learned from, or combined with each other. Identical terms, similar features, and similar implementation steps in different embodiments will not be repeated.
[0035] It is understood that in the message processing method provided in this disclosure embodiment, any method step can be executed by an electronic device and / or a server, and all steps in the method can be executed independently by the electronic device or the server, or jointly by the electronic device and the server.
[0036] The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. Electronic devices can be smartphones, tablets, laptops, desktop computers, smart voice interaction devices (such as smart speakers), wearable electronic devices (such as smartwatches), in-vehicle terminals, smart home appliances (such as smart TVs), AR / VR devices, etc., but are not limited to these.
[0037] The embodiments of this disclosure will be described subsequently using electronic devices as the execution subject; however, this does not constitute a limitation on the embodiments of this disclosure.
[0038] The message processing method provided in this disclosure can be applied to the interaction scheduling scenario between the gateway and sub-devices, and is particularly suitable for scenarios where the gateway needs to process messages reported by multiple types of devices. The main body executing this method is the gateway, which is responsible for unifying the access control of different communication protocols (such as Wi-Fi, Zigbee, Bluetooth, TPUNB, etc.) to achieve communication interaction with devices. Among them, TPUNB (Techphant Ultra-Narrow Band) is a low-power wide-area Internet of Things (LPWAN) wireless narrowband communication system.
[0039] Figure 1 A flowchart illustrating a message processing method provided in an embodiment of this disclosure is shown below. Figure 1 As shown, the method includes the following steps: Step S101: Obtain the target message reported by the target device in the device set. The message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device.
[0040] Specifically, in this embodiment of the disclosure, the device refers to a smart home device, or a sub-device or module in a smart home device. The gateway is connected to the device set, which includes at least one device. The specific device corresponding to the gateway and the number of devices can be determined according to actual needs.
[0041] It is understandable that the gateway supports a variety of different communication protocols, and each device may use a different communication protocol. In order to shield the differences in underlying protocols and reduce processing complexity, in this embodiment of the disclosure, after receiving the data reported by each device, the gateway converts the data reported by each device using different protocols into a standardized data format that the gateway can uniformly recognize, so as to facilitate subsequent processing and thus ensure the compatibility and efficiency of data access.
[0042] In this embodiment, the standardized data format can be set according to actual needs. For example, the standardized data format includes core fields such as device ID, reporting type, monitoring data, and timestamp. In this embodiment, the data reported by the device after being converted into a standardized data format via a gateway is referred to as a message.
[0043] The following describes in detail the steps of this embodiment of the disclosure, taking the example of the gateway interacting with any target device: In step S101, after receiving the data reported by the target device, the gateway converts the data into a pre-set standardized data format and obtains the target message reported by the target device in the device set. The message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device.
[0044] It is understandable that monitoring data refers to specific functional events or alarm information detected by the device in real time. It is the main content of the messages reported by the device, including but not limited to the functional status of the device and the data collected by the device. The monitoring data corresponding to each device corresponds to the device's own function. For example, when the device is a smoke alarm, the functional status can be "smoke alarm"; when the device is a water immersion sensor, the functional status can be "water leakage alarm"; when the device is a temperature and humidity sensor, the collected data can be "current temperature value" and "current humidity value".
[0045] Step S102: Obtain the reference information at the current moment and use it as the target reference information.
[0046] Specifically, in this embodiment, the reference information is independent of the message. When the gateway synchronously obtains the message reported by the device, it combines the characteristics of the message itself to determine the current decision basis for message processing priority, thus meeting differentiated actual needs.
[0047] The type of reference information is a pre-set information type used to determine priority. That is, the type of reference information remains unchanged at different times, but the reference information obtained in real time at each time is the specific data of the preset information type at the current time (such as numerical value, status code, string, etc.). The reference information at different times may be different.
[0048] For example, the types of reference information can include: time information (such as whether it is a holiday, day / night, etc.), gateway business scenarios (sleep scenarios, cinema scenarios, outing scenarios, etc.), environmental information (such as season, severe weather, air pollution, etc.), and user activity status (such as sleep, exercise, outing, etc.). Status codes can also be set for each information type and its corresponding optional statuses. The reference information includes the status code of the current status. For example, if the information type code corresponding to time information is A01, and the optional statuses are day and night, where the daytime status code is 1 and the nighttime status code is 0, then at the current time of 20:00, the reference information can include A01-0. The specific information types and quantities included in the reference information can be set according to actual needs.
[0049] The gateway takes the time when it obtains the target message reported by the target device as the current time. In step S102, it obtains the reference information of the current time and uses the reference information of the current time as the target reference information.
[0050] Step S103: Obtain the target configuration rule that matches the target message and target reference information from the pre-stored configuration rule library. Each configuration rule in the configuration rule library indicates the mapping relationship between the message, reference information and priority.
[0051] Specifically, the gateway pre-stores a configuration rule base, which includes multiple configuration rules. Each configuration rule indicates the mapping relationship between messages, reference information, and priorities. As the decision-making center for determining the priority of a message, the gateway can quickly map "message + reference information" to "priority" through the configuration rule base, thus determining the priority of the message. This allows the same alarm message to receive differentiated priorities in different scenarios. For example, when the message is a smoke alarm, it has the highest priority when the reference information is a sleep scenario, immediately triggering an alarm sound to remind the user to escape. However, when the reference information is a movie theater scenario, it has the second highest priority, only recording and pushing a notification message.
[0052] It is understandable that the message corresponding to the configuration rule mapping relationship can refer to the specific message itself, the message type, the device type, or a combination of message type and device type, which can be set according to the actual situation. For example, the message itself can refer to smoke alarm, water leak alarm, etc., the message type can refer to alarm information, periodic reported data, etc., and the device type can refer to sensor alarm, metering, video, etc.
[0053] In step S103, the gateway retrieves configuration rules that match the target message and target reference information from a pre-stored configuration rule base based on the acquired target message and target reference information, and uses them as target configuration rules.
[0054] Understandably, since both the "message" and "reference information" in the mapping relationship corresponding to the configuration rule can contain multiple elements, the target configuration rule needs to match all elements simultaneously. For example, if the elements corresponding to the message in the mapping relationship include device type A and message type B, and the elements corresponding to the "reference information" include business scenario C and time information D, then the mapping relationship of each configuration rule can be represented as: A+B+C+D→priority P.
[0055] If the target message is A1+B2 and the target reference information is C1+D3, the configuration rule corresponding to "A1+B2+C1+D3" needs to be searched in the configuration rule library as the target configuration rule.
[0056] Step S104: The priority indicated by the target configuration rule is used as the target priority to process the target message.
[0057] Specifically, after determining the target configuration rule, in step S104, the priority indicated by the target configuration rule is used as the target priority to process the target message.
[0058] It is understood that message processing refers to performing corresponding subsequent operations on messages according to their respective priorities. The priority determines when a message should be processed, such as immediately, queuing, or delayed processing, or determines a specific processing strategy, such as alarm notification, direct control, or no processing. The specific processing method can be adjusted according to different messages, and this disclosure does not limit this.
[0059] The technical solution provided in this disclosure introduces reference information independent of the message as one of the priority decision dimensions, constructing a "message + reference information" dual-dimensional dynamic priority configuration mechanism. A configuration rule base is pre-stored in the gateway. Each configuration rule in the configuration rule base indicates the mapping relationship between the message, reference information and priority. This allows the gateway to quickly find the target configuration rule that matches the target message and target reference information directly from the preset configuration rule base, and obtain the target priority for processing the target message. This enables the gateway to dynamically determine the processing priority that the same message should have under different circumstances based on the current actual situation reflected by the reference information, realizing differentiated configuration of priority strategy and adapting to the ever-changing actual application needs.
[0060] In one possible implementation, the reference information includes at least one of scenario information and status information. The scenario information indicates the business scenario of the gateway, and the status information is used to indicate at least one of the user's activity status, the device's operating status, and the environment's security status. The configuration rule base includes multiple first configuration rules, each of which is used to indicate the mapping relationship between at least one of the scenario information and status information, messages, and priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Find the first configuration rule in the configuration rule base that matches the target message and every item in the target reference information; If a first configuration rule exists in the configuration rule base that matches the target message and every item in the target reference information, then the first configuration rule that matches the target message and every item in the target reference information will be used as the target configuration rule.
[0061] Specifically, in this embodiment of the disclosure, the reference information includes at least one of scene information and state information. That is, at any given time, the reference information may include only scene information, only state information, or both scene information and state information. The scene information and state information are determined by the gateway based on time information and multi-dimensional data reported by each device, such as user location data, user sleep data, and images containing the user.
[0062] Scene information indicates the gateway's business scenarios, which may include: sleep scenarios, cinema scenarios, outing scenarios, home scenarios, etc., to reflect the overall operating mode of smart home devices set by the user.
[0063] It is understood that the scenario information in this embodiment is mainly used to obtain information such as time / space / behavior actively provided by the user. Its business scenario can be the same as the business scenario of the gateway to realize the linkage control of smart furniture devices, or it can be a variety of additional targeted business scenarios, such as: home scenario, short-term away scenario, long-term away scenario, etc. The user can actively select the corresponding business scenario on the gateway or APP.
[0064] Status information is used to indicate at least one of the user's activity status, the device's operating status, and the environment's safety status. The user's activity status may include being at home, sleeping, or away from home; the device's operating status may include being online, having low battery, or being faulty; and the environment's safety status may include being normal or abnormal. Status information may include multiple elements, such as activity status, operating status, and safety status, which can be determined according to actual needs.
[0065] It should be noted that the device's operating status is different from its monitoring data. The monitoring data focuses on describing "what the device detected," while the operating status indicates the device's own condition and focuses on describing "whether the device itself is normal."
[0066] Furthermore, since there may be conflicts between scene information and status information, or between different status information, this embodiment of the disclosure also sets up conflict arbitration logic to determine the credible party when a conflict occurs, so as to obtain unified and reliable status data. For example, if the scene information is "at home," but the user's activity status indicates that the user is out (location not at home), the conflict arbitration logic indicates that the reliability of the location information obtained by the device is higher than the business scene set by the user, and determines that the user is out.
[0067] The configuration rule library includes multiple first configuration rules, each of which is used to indicate the mapping relationship between at least one of the scenario information, status information, message, and priority.
[0068] In other words, the first configuration rule includes three cases: First, the first configuration rule is used to indicate the mapping relationship between message, scene information, and priority, which can be represented as a mapping form of "message + scene information → priority". Second, the first configuration rule is used to indicate the mapping relationship between message, status information, and priority, which can be represented as a mapping form of "message + status information → priority". Third, the first configuration rule is used to indicate the mapping relationship between message, scene information, status information, and priority, which can be represented as a mapping form of "message + scene information + status information → priority".
[0069] Understandably, in the first scenario, there are no restrictions on state information. In practical applications, state information not defined in the first configuration rule can be set to either be considered a mismatch by default or a match for all state information, depending on the requirements. That is, the target reference information includes target scenario information and target state information. When both the target message and the target scenario information conform to the first configuration rule, it is considered a mismatch by default (a mismatch occurs as long as target state information exists), or it is considered a match by default (all state information matches). The second scenario is similar and will not be elaborated upon here.
[0070] In the third case, the mapping form of the first configuration rule also includes forms such as "specific message + any scenario information + any status information → priority" or "specific message + any scenario information + specific status information → priority".
[0071] In addition, the rules in the configuration rule base can be either default rules pre-stored by the gateway or user-defined rules. The priority of configuration rules can also be set. For example, when user-defined rules are used, they take precedence. Among the default rules pre-stored by the gateway, the first configuration rule that includes both scene information and status information has a higher priority than the first configuration rule that only includes either scene information or status information.
[0072] It is understood that, in this embodiment of the disclosure, since the "message" and "status information" of the mapping relationship corresponding to the configuration rule can each contain multiple elements, the target configuration rule needs to match all elements at the same time, and the total number of elements that the configuration rule needs to match is determined according to the actual settings.
[0073] After the gateway obtains the target message reported by the target device, it determines the target reference information, including the target scenario information and / or target status information, and searches the configuration rule base for the first configuration rule that matches the target message, target scenario information, and target status information.
[0074] If it is determined that there exists a first configuration rule in the configuration rule base that matches the target message and every item in the target reference information, then it means that an exact match has been achieved, and the first configuration rule that matches the target message and every item in the target reference information is taken as the target configuration rule.
[0075] Understandably, each piece of information included in the target reference information is used as a matching condition to match the first configuration rule. For example, if the target reference information only includes target scenario information (meeting the first case above), then the first configuration rule matching the target message and target scenario information is determined from the configuration rule base. If the target reference information only includes target scenario information and target status information (meeting the third case above), then the first configuration rule matching the target message, target scenario information, and target status information is determined from the configuration rule base.
[0076] For example, the target reference information includes target scene information and target status information. The target message is "smoke alarm - smoke alarm", the target scene information is "sleep scene", and the target status information is "user is sleeping". If there is a first configuration rule in the configuration rule library, "smoke alarm + sleep scene + user is sleeping → P0 (highest priority)", then this rule will be used as the target configuration rule, triggering an immediate local alarm and pushing it to the user terminal.
[0077] The technical solution provided in this disclosure subdivides reference information into scenario information and status information, and constructs a three-dimensional priority dynamic configuration mechanism of "message + scenario + status". Scenario information reflects the user's subjective intention for setting business scenarios, and status information objectively reflects the real-time status of each status. The combination of the two realizes the dual perception of "subjective needs + objective conditions", and achieves the refinement of message priority configuration.
[0078] In one possible implementation, where the target reference information includes target scene information and target state information, the method further includes: If there is no first configuration rule in the configuration rule base that matches the target message and matches each item in the target reference information, then the first configuration rule that matches the target message and matches one of the target scenario information and the target status information is obtained as the reference configuration rule. Based on the priority of each reference configuration rule, obtain the target priority corresponding to the target message.
[0079] Specifically, when the target reference message includes target scene information and target status information, there may be a situation where there is no first configuration rule in the configuration rule base that matches the target message and matches every item in the target reference information (i.e., it cannot match both the target scene information and the target status information). This disclosure embodiment also provides fuzzy matching, which is applied to solve the problem that the configuration rule base cannot fully cover and achieve accurate matching in the above situation.
[0080] During fuzzy matching, the first configuration rule that matches the target message and also matches either the target scene information or the target state information is used as the reference configuration rule.
[0081] For example: if the target message is "water immersion sensor - water leakage alarm", the target scene information is "outdoor scene", and the target status information is "user in motion", and there is no rule in the configuration rule base that completely matches all three, but there are two rules: "water immersion alarm + outdoor scene + user in sleep → P1" and "water immersion alarm + home scene + user in motion → P2", then both of them will be used as reference configuration rules.
[0082] Understandably, since the elements corresponding to the status information can be multiple, the requirements for fuzzy matching can be adaptively adjusted by considering factors such as the number of items corresponding to the actual status information and the number of reference configuration rules that the fuzzy matching requirements can filter out. For example, if the status information corresponds to 3 elements, the first configuration rule that matches the target message and target scene information, and matches two of the three elements of the target status information (or matches the target message, and matches two of the three elements of the target scene information and target status information) can be used as the reference configuration rule.
[0083] Based on the priorities corresponding to each reference configuration rule, obtain the target priority corresponding to the target message. The specific methods for determining the target priority based on the priorities corresponding to the reference configuration rules include, but are not limited to, selecting the highest priority corresponding to each reference configuration rule as the target priority, calculating the average or weighted value of priorities to determine the target priority, and selecting the priorities corresponding to the maximum number of reference configuration rules as the target priority.
[0084] Additionally, it should be noted that the first configuration rule includes three scenarios, which can be determined based on actual needs. When filtering reference configuration rules using fuzzy matching, it's important to determine whether to exclude first configuration rules that only map to a single piece of environmental or status information. If not excluded, a higher weight can be assigned during priority calculation for first configuration rules that only map to a single piece of environmental or status information.
[0085] The technical solution provided in this disclosure provides a fuzzy matching method to obtain reference configuration rules through partial matching, and reasonably derives target priorities based on the reference configuration rules. This avoids the dilemma of message processing being unable to follow any rules due to the inability to match precisely, reduces the complexity of the rule configuration library, eliminates the need to exhaustively list all scenario-state combinations, reduces rule redundancy and maintenance costs, enables refined priority decision-making in complex scenarios, and improves the adaptability and flexibility of the gateway.
[0086] In one possible implementation, the reference information includes at least one of scenario information and state information, and the configuration rule base includes multiple second configuration rules and multiple third configuration rules. The second configuration rules include the mapping relationship between messages and basic priorities, and the third configuration rules include the mapping relationship between at least one of scenario information and state information and the change amount of basic priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Determine the target second configuration rule that matches the message from the configuration rule base, and obtain the target basic priority corresponding to the target second configuration rule; Determine the target third configuration rule that matches each item in the target reference information from the configuration rule base, and obtain the target change amount corresponding to the target third configuration rule; Adjust the basic priority of the target based on the change in the target, and obtain the target priority.
[0087] Specifically, the reference information includes at least one of scenario information and status information. In this embodiment of the disclosure, the configuration rule base adopts a layered decoupled structure, dividing the configuration rules into two categories: second configuration rules and third configuration rules.
[0088] The configuration rule base includes multiple second configuration rules and multiple third configuration rules. The second configuration rules include the mapping relationship between messages and basic priorities, and the third configuration rules include the mapping relationship between at least one of scenario information and status information and the change in basic priorities.
[0089] Understandably, the basic priority refers to the priority corresponding to the message itself, which is equivalent to the fixed priority set statically in existing technologies, such as "smoke alarm → P0" and "temperature report → P2". This can be set based on the message itself, the message type, and the device type. The change amount refers to the dynamic adjustment range of the priority reflected by at least one of the scene information and status information. For example, when the reference information is "sleep scene + user is sleeping", the change amount is "+2".
[0090] After the gateway obtains the target message and target reference information, it determines the target scenario information and / or target status information included in the target reference information. First, it matches the second configuration rule from the configuration rule library to determine the target second configuration rule that matches the message, and obtains the target basic priority corresponding to the target second configuration rule.
[0091] Then, match the third configuration rule from the configuration rule library to determine the target third configuration rule that matches each item in the target reference information, and obtain the target change amount corresponding to the target third configuration rule.
[0092] Adjust the target's base priority based on the target's change to obtain the target priority. For example, if the target's base priority is determined to be P1 and the target's change is -1, adjust the target's base priority based on the target's change to obtain the target priority P2. It can be understood that priorities have upper and lower limits (such as P0-P3), and the adjusted target priority needs to be within the range of the upper and lower limits.
[0093] It is understandable that, similar to the first configuration rule, the third configuration rule also includes three cases: a mapping relationship with a single environmental or state information, and a mapping relationship with both environmental and state information.
[0094] Correspondingly, each piece of information included in the target reference information is used as a matching condition to match the third configuration rule. The specific matching method is the same as the matching method of the first configuration rule. When the target reference information includes target scene information and target state information, and precise matching cannot be achieved, fuzzy matching can also be applied. The third configuration rule that matches either the target scene information or the target state information is selected as a reference to calculate the target change amount, which will not be elaborated here. The technical solution provided in this embodiment decouples the message priority itself from the dynamic adjustment amount of the environment. The second configuration rule configures the priority of the message itself, and the second configuration rule configures the change amount to reflect the influence of reference information (scene information and / or state information) on the priority of the message itself. Compared with the "message + reference information" type of configuration rule, it can cover more scenarios with fewer rules, and can adapt and port new messages and reference information at low cost, significantly reducing the complexity of operation and maintenance and storage overhead.
[0095] The hierarchical rule base and intelligent matching scheme provided in this disclosure adopt a hierarchical architecture of "user-configured rules first + preset configuration rules as a fallback", combined with precise matching and fuzzy matching logic, and can also cache frequently used high-frequency configuration rules, taking into account both personalization and efficiency.
[0096] In one possible implementation, processing the target message includes: The target message is added to the message queue corresponding to the target priority. The message queue stores all messages of the corresponding priority in the order they are stored. Consume messages from each queue in descending order of priority. For each message queue, perform consumption operations on the message queue, including: The messages in the message queue are processed sequentially until the consumption time of the message queue currently being consumed reaches the preset time, at which point the message queue for the next consumption operation is determined. If the message queue currently being consumed does not correspond to the lowest priority, then the message queue with the next lower priority will be used as the message queue for the next consumption operation. If the message queue currently being consumed corresponds to the lowest priority, then the message queue with the highest priority will be used as the message queue for the next consumption operation.
[0097] Specifically, for any message, the message is delivered to the message queue of the corresponding priority. Each priority message queue stores all messages corresponding to that priority in the order they are stored. This disclosure provides a message processing method that combines first-in-first-out and time-slice round-robin mechanisms.
[0098] Taking the processing method of the target message corresponding to the target device as an example, the target message is added to the message queue corresponding to the target priority. The message queue stores all messages of the corresponding priority in the order in which the messages are stored. That is, the message stored first is sorted first in the message queue.
[0099] Based on multiple pre-set priorities, the message queues corresponding to the priorities are consumed in descending order of priority. For each message queue, the consumption operation means processing each message in the order in which the messages were stored in the message queue, so as to realize the first-in-first-out (FIFO) principle.
[0100] The specific steps for consuming a message queue include: The message queue currently being consumed is designated as the first message queue. Messages in the first message queue are processed sequentially until the consumption time of the first message queue reaches the preset duration. Then, the process switches to the second message queue. The specific value of the preset duration can be determined according to actual needs.
[0101] It is understandable that there may be a situation where all messages in the first message queue are processed within the preset time. In this case, the process can be switched directly to the second message queue. That is, when the first message queue is empty, the process is switched to the second message queue.
[0102] In addition, the purpose of setting a preset duration is to limit the processing time of a single message queue, avoiding continuous processing of messages in a single message queue and blocking the processing of messages in other message queues. Correspondingly, in addition to setting a preset duration, the number of messages processed in a single consumption operation for each message queue can also be limited. The number of messages processed can be set to be the same for each priority level, or positively correlated with the priority level, with higher priority messages being processed more.
[0103] The second message queue refers to the message queue for the next consumption operation after the consumption operation of the first message queue. The specific method for determining the second consumption queue is as follows: If the first message queue does not correspond to the lowest priority, then the message queue with the next lower priority is used as the second message queue. If the first message queue corresponds to the lowest priority, then the message queue with the highest priority is used as the second message queue.
[0104] For example, using a specific example, the pre-set priorities include four levels from high to low, P0 to P3. When the priority corresponding to the first message queue is P1, the message queue corresponding to P2 is used as the second message queue; when the priority of the first message queue is P3, the message queue corresponding to P0 is used as the second message queue.
[0105] In other words, in practical applications, consumption operations of different priorities can be regarded as loops. The message queue corresponding to each priority Pi is denoted as Mi. Taking the first message queue to be processed as M0 as an example, the message queues for consumption operations in sequence can be denoted as a loop of "M0—M1—M2—M3—M0—M1…".
[0106] The technical solution provided in this disclosure provides a message processing method that combines first-in-first-out (FIFO) and time-slice round-robin mechanisms. By limiting the duration of a single consumption operation in a message queue, it can effectively prevent high-load message queues from blocking the processing of other message queues, thus avoiding long-term blocking of priority messages and ensuring that all types of messages can be processed in an orderly manner.
[0107] In one possible implementation, when the target priority corresponds to the highest priority, the message queues are consumed sequentially, including: If the message queue currently being consumed is not the message queue corresponding to the target priority, pause processing of messages in the message queue currently being consumed; Messages are processed sequentially according to the order of messages in the message queue corresponding to the target priority, until all messages in the message queue corresponding to the target priority have been processed, then processing of messages in the currently consumed message queue resumes.
[0108] Specifically, this disclosure also provides a differentiated message processing method. Figure 2 This is a flowchart illustrating a differentiated message processing method provided in an embodiment of the present disclosure, such as... Figure 2 As shown, different consumption operations are performed for the highest priority and other priorities.
[0109] For other priorities, non-preemptive scheduling is adopted, and message processing is still implemented using the above-mentioned combination of first-in-first-out and time-slice round-robin mechanism.
[0110] For the highest priority message, preemptive scheduling is used. That is, when there are pending messages in the message queue corresponding to the highest priority message, processing of other non-highest priority messages that are currently being processed is stopped, and messages in the message queue corresponding to the highest priority message are processed first. When the target priority corresponds to the highest priority, consumption operations are performed on each message queue sequentially, including: If the message queue currently being consumed is not the message queue corresponding to the target priority, processing of messages in the currently consumed message queue will be paused.
[0111] Messages are processed sequentially according to the order of messages in the message queue corresponding to the target priority, until all messages in the message queue corresponding to the target priority have been processed, then processing of messages in the currently consumed message queue resumes.
[0112] For example, the pre-set priorities include four levels from high to low, P0-P3, and the message queue corresponding to each priority Pi is denoted as Mi. P0, as the highest priority, adopts preemptive scheduling, which can pause the currently processed low-priority tasks and prioritize the execution of urgent instructions; P1-P3 adopt non-preemptive scheduling, combining first-in-first-out and time-slice round-robin mechanisms to ensure that various instructions are executed in an orderly manner.
[0113] When the message queue currently being consumed is M3, if M0 is detected to be not empty, the processing of messages in M3 is paused and messages in M0 are processed first, until it is determined that M0 is empty, then the processing of messages in M3 is resumed.
[0114] It should be noted that, considering that if there are many priority levels set or a large number of messages in the highest priority message queue, resulting in long processing times, resuming the previously paused message queue and looping back to process the second highest priority message queue may result in excessive processing time and difficulty in guaranteeing the real-time performance of some messages. After all messages in the message queue corresponding to the target priority have been processed, you can directly switch to process the second highest priority M2, or you can switch to process the second highest priority M2 after processing the paused messages.
[0115] For example, if priorities are set to P0-P6 and the paused message queue is M2, then to resume processing, M2-M3-M4-M5-M6-M1... must be processed sequentially after processing M0 before reaching the message queue M1 corresponding to the next highest priority P1. In this case, after processing M0, you can directly switch to processing M1, that is, process M1-M2-M3-M4... sequentially.
[0116] The technical solution provided in this disclosure introduces a highest priority preemption mechanism on the basis of a basic message processing method that combines first-in-first-out and time-slice round-robin mechanisms. When a message appears in the highest priority message queue, the processing of the current low-priority (non-highest priority) message queue is immediately paused. The highest priority message queue is cleared first, and then the processing of the current low-priority message queue is resumed. This ensures that the highest priority critical message has absolute priority response rights and zero-delay processing, meeting the real-time requirements of critical messages.
[0117] In one possible implementation, processing the target message includes at least one of the following: Send a notification message to the user terminal, which includes real-time monitoring data of the target device reported by the target device; Send an acknowledgment frame to the target device. The acknowledgment frame is used to confirm whether the monitoring data reported by the target device is accurate. The system receives a response frame from the target device in response to the acknowledgment frame. If the monitoring data is confirmed to be accurate based on the response frame, the system obtains and stores the relevant information for processing the target message as a log. The relevant information includes the monitoring data, the target priority, and the processing time of the target message.
[0118] Specifically, Figure 3 This is a schematic flowchart of a method for processing a target message provided in an embodiment of this disclosure, as shown below. Figure 3 As shown, embodiments of this disclosure provide various methods for processing target messages.
[0119] On the one hand, it pushes notifications to users, that is, sends prompt information to user terminals. The prompt information includes real-time monitoring data of the target device reported by the target device, such as alarm information, status reminders or periodically reported data.
[0120] For example, an alarm message can be pushed to the user's terminal APP. The message includes the target device identifier, real-time monitoring data such as "the smoke alarm in the living room detected that the smoke concentration exceeded the standard", and the processing time, so as to ensure that the user can perceive the device monitoring data in real time.
[0121] On the other hand, a confirmation frame is sent to the target device to verify the accuracy of the monitoring data reported by the target device. The system receives a response frame from the target device in response to the confirmation frame and determines the accuracy of the monitoring data based on the response frame, thereby ensuring accurate and unlost data transmission and achieving closed-loop confirmation of message transmission and processing.
[0122] Furthermore, if the accuracy of the monitoring data is confirmed upon receiving a response frame, relevant information about the target message can be obtained and stored as a log. This information includes monitoring data, target priority, and the processing time of the target message. In addition, relevant information may also include the total processing time, processing measures, etc., which can be set according to actual needs.
[0123] For example, an acknowledgment frame is sent to the target device. This frame carries a message sequence number and verification information to confirm that the monitoring data reported by the device has been correctly received by the gateway. After receiving the acknowledgment frame, the target device stops its local retransmission timer. If an acknowledgment frame is not received within a preset time limit, the retransmission mechanism is automatically triggered, retrying up to three times until acknowledgment is obtained or the upper limit is reached. This ensures the reliability of data transmission between the gateway and the data source, and completes the closed-loop confirmation of message processing.
[0124] The gateway receives the response frame returned by the target device in response to the confirmation frame, parses the verification result in the response frame, and if it is determined that the monitoring data is accurate, it aggregates and stores the relevant information such as monitoring data, target priority, processing time and device response latency into a structured log for subsequent auditing and system optimization, and provides data support for fault diagnosis and responsibility determination.
[0125] It should be noted that the above processing methods can be applied individually or simultaneously to send prompts to the user terminal, send confirmation frames to the device, and record logs, completing a closed-loop two-way feedback process. Different processing methods can be set for messages of each priority level. For example, for low-priority messages, the gateway can send prompts containing monitoring data from multiple messages to the user terminal at intervals, while for high-priority messages, the gateway can trigger the above processing methods in parallel.
[0126] According to another aspect of the present disclosure, a message processing system is provided, including a gateway and at least one device, wherein the gateway, when executing, implements the steps of the message processing method described above.
[0127] Specifically, the message processing system in this embodiment includes a gateway and at least one device, and the number and type of devices can be set according to actual needs.
[0128] For detailed steps of message processing by the gateway in the message processing system, please refer to the relevant description of the message processing method implemented on the gateway side mentioned above, which will not be repeated here.
[0129] The following example illustrates the message processing method provided in this disclosure. The software logic architecture is designed with the core concepts of "local autonomous operation, low latency across the entire link, and modular collaboration". All construction steps are completed locally on the gateway, without relying on cloud support, ensuring stable operation in the absence of network access.
[0130] The gateway's software logic architecture is divided into five core layers from top to bottom: access layer, decision layer, execution layer, feedback layer, and data layer. Each layer has clearly defined responsibilities and works in concert.
[0131] Users manually activate "Business Trip Mode" via the app. The gateway recognizes that the user is away from home, and during this time, all the door and window sensors report "abnormal opening," triggering dynamic priority adjustment and emergency dispatch. The specific implementation steps are explained below in conjunction with the five layers of the gateway: The access layer enables standardized data access. Door and window sensors report "abnormal opening" data through their own protocols. After receiving the data, the multi-protocol adaptation component of the access layer outputs a target message in a standardized data format: {"device_id":"door_001","report_type":"door_open","state":"abnormal","timestamp":1700000000}, and pushes it to the decision layer.
[0132] Figure 4 This is a flowchart illustrating a reference information acquisition method provided in an embodiment of the present disclosure, such as... Figure 4 As shown, the decision-making layer simultaneously initiates scene recognition and state awareness to achieve dual recognition of scene and state. The scene recognition component combines "user manually activates business trip scenario + door lock locked status + Bluetooth positioning of user outdoors" to output scene information: {"scene_type":"business scenario","scene_value":"business trip scenario"}. The state awareness component simultaneously determines the user's activity status as "outside", the device's operating status as "online and normal", and the environment's security status as "emergency and abnormal". There are no state conflicts, and the combination of the output scene information and state information yields reference information.
[0133] The decision-making layer makes dynamic decisions on priorities, while the priority rule engine in the execution layer loads the configuration rule library, determines the change in priority according to the established matching logic, combined with scenario information and status information, in order to adjust the basic priority determined by the message, and outputs the final determined target priority.
[0134] The decision-making level matched the configuration rule "business trip mode + user away + abnormal opening of doors and windows → reporting priority is increased from P2 to P0". Since there is no user-defined conflict rule, the target priority P0 is output according to the exact matching result.
[0135] The hierarchical scheduling component in the execution layer implements differentiated message processing. When a target message of level P0 is detected, the gateway is currently processing a message reported by a level P2 temperature and humidity sensor. The low-priority message is immediately paused, and system resources are preempted to prioritize the processing of target messages related to door and window anomalies.
[0136] In the feedback layer, the two-way feedback component pushes an alarm message "Business Trip Mode - Abnormal Opening of Doors and Windows" to the user's APP as soon as possible, and sends an acknowledgment frame to the door and window sensor. After receiving the acknowledgment frame, the sensor responds, and the component records the scheduling log to the local database. The scheduling log includes the reason for priority adjustment, execution time, and feedback result.
[0137] After scheduling is completed, the execution layer resumes the messages reported by the P2 level temperature and humidity sensors that were previously suspended. The entire process takes 110ms. All steps are executed locally without any impact from the network outage, ensuring timely response to security alarms during business trips.
[0138] In the data layer, the caching module is responsible for storing scenario information, status information, and frequently accessed configuration rules with high real-time requirements, ensuring fast data retrieval; the local database is used to persistently store complete configuration rule base, scheduling logs, user configurations, and other data, providing support for subsequent traceability and rule optimization.
[0139] Compared with existing static priority schemes, the scheme provided in this disclosure can achieve dynamic adaptation and precise matching of priorities, breaking through the limitations of static hierarchical classification. It adjusts message priorities in real time through "scene information + status information" to adapt to different scenario needs such as business trips and sleep, improving scenario fit by 90%+. The local closed loop is stable and reliable. The core logic of the entire chain, from device access to information identification and acquisition, priority configuration decision-making, message scheduling and processing, and processing result feedback, is completed locally on the gateway. It includes two-way feedback of user notification reminders, device confirmation, and retry, as well as the ability to operate offline. P0-level reporting is advanced, and there is no risk of cloud dependency. It is personalized and flexible to expand: it supports a hierarchical rule base of "system default + user-defined" to adapt to differentiated needs such as elderly care and security monitoring, with low configuration costs.
[0140] Figure 5 This is a schematic diagram of the structure of a gateway provided in an embodiment of the present disclosure, such as... Figure 5 As shown, another aspect of this disclosure provides a gateway 50, including: The message acquisition module 501 is used to acquire target messages reported by target devices in the device set. The message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device. The information acquisition module 502 is used to acquire reference information at the current moment and use it as target reference information; The priority configuration module 503 is used to retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule library. Each configuration rule in the configuration rule library indicates the mapping relationship between the message, reference information and priority. The message processing module 504 is used to process target messages by taking the priority indicated by the target configuration rule as the target priority.
[0141] In one possible implementation, the reference information includes at least one of scenario information and status information. The scenario information indicates the business scenario of the gateway, and the status information is used to indicate at least one of the user's activity status, the device's operating status, and the environment's security status. The configuration rule base includes multiple first configuration rules, each of which is used to indicate the mapping relationship between at least one of the scenario information and status information, messages, and priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Find the first configuration rule in the configuration rule base that matches the target message and every item in the target reference information; If a first configuration rule exists in the configuration rule base that matches the target message and every item in the target reference information, then the first configuration rule that matches the target message and every item in the target reference information will be used as the target configuration rule.
[0142] In one possible implementation, where the target reference information includes target scene information and target state information, the method further includes: If there is no first configuration rule in the configuration rule base that matches the target message and matches each item in the target reference information, then the first configuration rule that matches the target message and matches one of the target scenario information and the target status information is obtained as the reference configuration rule. Based on the priority of each reference configuration rule, obtain the target priority corresponding to the target message.
[0143] In one possible implementation, the reference information includes at least one of scenario information and state information, and the configuration rule base includes multiple second configuration rules and multiple third configuration rules. The second configuration rules include the mapping relationship between messages and basic priorities, and the third configuration rules include the mapping relationship between at least one of scenario information and state information and the change amount of basic priorities. Retrieve target configuration rules that match the target message and target reference information from a pre-stored configuration rule base, including: Determine the target reference information, which includes at least one of the target scene information and the target state information; Determine the target second configuration rule that matches the message from the configuration rule base, and obtain the target basic priority corresponding to the target second configuration rule; Determine the target third configuration rule that matches each item in the target reference information from the configuration rule base, and obtain the target change amount corresponding to the target third configuration rule; Adjust the basic priority of the target based on the change in the target, and obtain the target priority.
[0144] In one possible implementation, processing the target message includes: The target message is added to the message queue corresponding to the target priority. The message queue stores all messages of the corresponding priority in the order they are stored. Consume messages from each queue in descending order of priority. For each message queue, perform consumption operations on the message queue, including: The messages in the message queue are processed sequentially until the consumption time of the message queue currently being consumed reaches the preset time, at which point the message queue for the next consumption operation is determined. If the message queue currently being consumed does not correspond to the lowest priority, then the message queue with the next lower priority will be used as the message queue for the next consumption operation. If the message queue currently being consumed corresponds to the lowest priority, then the message queue with the highest priority will be used as the message queue for the next consumption operation.
[0145] In one possible implementation, when the target priority corresponds to the highest priority, the message queues are consumed sequentially, including: If the message queue currently being consumed is not the message queue corresponding to the target priority, pause processing of messages in the message queue currently being consumed; Messages are processed sequentially according to the order of messages in the message queue corresponding to the target priority, until all messages in the message queue corresponding to the target priority have been processed, then processing of messages in the currently consumed message queue resumes.
[0146] In one possible implementation, processing the target message includes at least one of the following: Send a notification message to the user terminal, which includes real-time monitoring data of the target device reported by the target device; Send an acknowledgment frame to the target device. The acknowledgment frame is used to confirm whether the monitoring data reported by the target device is accurate. The system receives a response frame from the target device in response to the acknowledgment frame. If the monitoring data is confirmed to be accurate based on the response frame, the system obtains and stores the relevant information for processing the target message as a log. The relevant information includes the monitoring data, the target priority, and the processing time of the target message.
[0147] The gateway in this embodiment can execute the methods provided in this embodiment, and their implementation principles are similar. The actions performed by each module in each embodiment of this disclosure correspond to the steps in the methods of each embodiment of this disclosure. For detailed functional descriptions of the modules, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.
[0148] This disclosure provides an electronic device (computer device / equipment / system) including a memory, a processor, and a computer program stored in the memory. The processor executes the computer program to implement the steps of the method provided in any optional embodiment of this disclosure, and introduces reference information independent of the message as one of the priority decision dimensions to construct a "message + reference information" dual-dimensional priority dynamic configuration mechanism. A configuration rule base is pre-stored in the gateway. Each configuration rule in the configuration rule base indicates the mapping relationship between the message, reference information, and priority. This allows the gateway to quickly find the target configuration rule that matches the target message and target reference information directly from the preset configuration rule base, and obtain the target priority for processing the target message. This enables the gateway to dynamically determine the processing priority that the same message should have under different circumstances based on the current actual situation reflected by the reference information, realizing differentiated configuration of priority strategy and adapting to the technical effect of changing actual application needs.
[0149] In one alternative embodiment, an electronic device is provided. Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure, such as... Figure 6 As shown, the electronic device 60 includes a processor 601 and a memory 603. The processor 601 and the memory 603 are connected, for example, via a bus 602. Optionally, the electronic device 60 may further include a transceiver 604, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. It should be noted that in practical applications, the transceiver 604 is not limited to one type, and the structure of the electronic device 60 does not constitute a limitation on the embodiments of this disclosure.
[0150] Processor 601 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in connection with this disclosure. Processor 601 may also be a combination that implements computational functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0151] Bus 602 may include a pathway for transmitting information between the aforementioned components. Bus 602 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 602 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0152] The memory 603 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), CD-ROM (Compact Disc Read Only Memory) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium capable of carrying or storing computer programs and capable of being read by a computer, without limitation herein.
[0153] The memory 603 is used to store computer programs that execute embodiments of the present disclosure, and the execution is controlled by the processor 601. The processor 601 is used to execute the computer programs stored in the memory 603 to implement the steps shown in the foregoing method embodiments.
[0154] The electronic devices in this disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable devices, and fixed terminals such as digital TVs and desktop computers.
[0155] This disclosure provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.
[0156] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments. Compared with the prior art, it introduces reference information independent of the message as one of the priority decision dimensions, constructing a "message + reference information" dual-dimensional priority dynamic configuration mechanism. A configuration rule base is pre-stored in the gateway, and each configuration rule in the rule base indicates the mapping relationship between the message, reference information, and priority. This allows the gateway to quickly find the target configuration rule matching the target message and target reference information directly from the preset configuration rule base, and obtain the target priority for processing the target message. This enables the gateway to dynamically determine the processing priority that the same message should have under different circumstances based on the current actual situation reflected by the reference information, achieving differentiated configuration of the priority strategy and adapting to the technical effect of changing practical application needs.
[0157] It should be noted that the computer-readable storage medium described above in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, gateway, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.
[0158] In this disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used or combined with an instruction execution system, gateway, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof.
[0159] Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit programs for use by or in connection with an instruction execution system, gateway, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0160] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0161] The terms “first,” “second,” “third,” “fourth,” “1,” “2,” etc. (if present) in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in a sequence other than that shown in the figures or text.
[0162] It should be understood that although arrows indicate various operation steps in the flowcharts of the embodiments of this disclosure, the order in which these steps are implemented is not limited to the order indicated by the arrows. Unless explicitly stated herein, in some implementation scenarios of the embodiments of this disclosure, the implementation steps in each flowchart can be executed in other orders as required. Furthermore, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage can also be executed at different times. In scenarios where execution times differ, the execution order of these sub-steps or stages can be flexibly configured as required, and the embodiments of this disclosure do not limit this.
[0163] The above description is only an optional implementation method for some implementation scenarios of this disclosure. It should be noted that for those skilled in the art, other similar implementation methods based on the technical concept of this disclosure without departing from the technical concept of this disclosure also fall within the protection scope of the embodiments of this disclosure.
Claims
1. A message processing method, characterized in that, Applied to a gateway, the method includes: Obtain the target message reported by the target device in the device set, wherein the message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device; Obtain the reference information at the current moment and use it as the target reference information; From a pre-stored configuration rule base, a target configuration rule matching the target message and the target reference information is obtained, wherein each configuration rule in the configuration rule base indicates the mapping relationship between the message, the reference information and the priority; The target message is processed using the priority indicated by the target configuration rule as the target priority.
2. The method according to claim 1, characterized in that, The reference information includes at least one of scenario information and status information. The scenario information indicates the service scenario of the gateway, and the status information is used to indicate at least one of the user's activity status, the device's operating status, and the environment's security status. The configuration rule base includes multiple first configuration rules, and each first configuration rule is used to indicate the mapping relationship between at least one of the scenario information and the status information, the message, and the priority. The step of retrieving the target configuration rule matching the target message and the target reference information from the pre-stored configuration rule base includes: Determine the target reference information, wherein the target reference information includes at least one of target scene information and target state information; The first configuration rule is searched from the configuration rule base to match the target message and to match each item in the target reference information; If a first configuration rule exists in the configuration rule base that matches the target message and each item in the target reference information, then the first configuration rule that matches the target message, the target scene information, and the target state information will be used as the target configuration rule.
3. The method according to claim 2, characterized in that, When the target reference information includes target scene information and target state information, the method further includes: If there is no first configuration rule in the configuration rule base that matches the target message and matches each item in the target reference information, then the first configuration rule that matches the target message and matches one of the target scene information and the target state information is obtained as a reference configuration rule. Based on the priority of each reference configuration rule, obtain the target priority corresponding to the target message.
4. The method according to claim 1, characterized in that, The reference information includes at least one of scenario information and status information. The configuration rule base includes multiple second configuration rules and multiple third configuration rules. The second configuration rule includes the mapping relationship between the message and the basic priority. The third configuration rule includes the mapping relationship between at least one of the scenario information and status information and the change amount of the basic priority. The step of retrieving the target configuration rule matching the target message and the target reference information from the pre-stored configuration rule base includes: Determine the target reference information, wherein the target reference information includes at least one of target scene information and target state information; Determine the target second configuration rule that matches the message from the configuration rule base, and obtain the target basic priority corresponding to the target second configuration rule; Determine the target third configuration rule that matches each item in the target reference information from the configuration rule base, and obtain the target change amount corresponding to the target third configuration rule; Adjust the target base priority based on the target change amount to obtain the target priority.
5. The method according to any one of claims 1-4, characterized in that, The processing of the target message includes: The target message is added to the message queue corresponding to the target priority. The message queue stores all messages of the corresponding priority in the order in which the messages are stored. Consume messages from each queue in descending order of priority. For each message queue, a consumption operation is performed on the message queue, including: The messages in the message queue are processed sequentially until the consumption time of the message queue currently being consumed reaches a preset time, and then the message queue for the next consumption operation is determined. If the message queue currently being consumed does not correspond to the lowest priority, then the message queue with the next lower priority will be used as the message queue for the next consumption operation. If the message queue currently being consumed corresponds to the lowest priority, then the message queue with the highest priority will be used as the message queue for the next consumption operation.
6. The method according to claim 5, characterized in that, When the target priority corresponds to the highest priority, the step of sequentially consuming each message queue includes: If the message queue currently being consumed is not the message queue corresponding to the target priority, processing of messages in the message queue currently being consumed will be suspended. Messages are processed sequentially according to the order of messages in the message queue corresponding to the target priority, until all messages in the message queue corresponding to the target priority have been processed, and then processing of messages in the message queue currently being consumed is resumed.
7. The method according to any one of claims 1-4, characterized in that, The processing of the target message includes at least one of the following: Send a prompt message to the user terminal, the prompt message including real-time monitoring data of the target device reported by the target device; Send an acknowledgment frame to the target device, the acknowledgment frame being used to confirm whether the monitoring data reported by the target device is accurate; The system receives a response frame sent by the target device in response to the confirmation frame. If the monitoring data is determined to be accurate based on the response frame, the system obtains relevant information about processing the target message and stores it as a log. The relevant information includes the monitoring data, the target priority, and the processing time of the target message.
8. A gateway, characterized in that, include: The message acquisition module is used to acquire target messages reported by target devices in the device set. The message reported by each device in the device set is used to describe the real-time monitoring data of the corresponding device. The information acquisition module is used to acquire reference information at the current moment and use it as target reference information; The priority configuration module is used to obtain target configuration rules that match the target message and the target reference information from a pre-stored configuration rule library. Each configuration rule in the configuration rule library indicates the mapping relationship between the message, the reference information and the priority. The message processing module is used to process the target message by taking the priority indicated by the target configuration rule as the target priority.
9. A message processing system, characterized in that, Includes a gateway and at least one device; When the gateway is executed, it implements the steps of the method according to any one of claims 1-7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.